Working with Images

Getting the sprawl access point image

Download the operating system image for the sprawl access points! According to its postfix .xz the image is compressed with the XZ compression algorithm. Before writing the image to the sd card it has to be decompressed.

On Ubuntu/Debian you can install xz-utils and use unxz:

$ sudo apt-get install xz-utils
unxz sprawl_pi_image_20200628_shrinked.img.xz

On MacOS try the unarchiver. On Windows try the usual way to decompress files or download xz-utils.

Writing images on sd card

MacOS

➜  ~ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         1000.0 GB  disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1000.0 GB  disk1
                                 Physical Store disk0s2
   1:                APFS Volume OWC Aura Pro SSD - Data 520.8 GB   disk1s1
   2:                APFS Volume Preboot                 82.6 MB    disk1s2
   3:                APFS Volume Recovery                525.8 MB   disk1s3
   4:                APFS Volume VM                      2.1 GB     disk1s4
   5:                APFS Volume OWC Aura Pro SSD        11.2 GB    disk1s5

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *63.9 GB    disk2
   1:             Windows_FAT_32 boot                    268.4 MB   disk2s1
   2:                      Linux                         63.6 GB    disk2s2

disk2 seems to be the sd card with 64 GB. To access the raw device /dev/rdisk2 is used. To write to this device you have to be root (administrator). Unmount the device before using dd.

diskutil unmountDisk /dev/disk2
sudo dd if=rpi.img of=/dev/rdisk2 bs=4M

Linux

$ sudo dd if=rpi.img of=/dev/disk/by-id/
ata-PLDS_DVD-RW_DS8A8SH_S45N7592Z1ZKBE0758TK
ata-SAMSUNG_MZMPA016HMCD-000L1_S11BNEACC10413
ata-SAMSUNG_MZMPA016HMCD-000L1_S11BNEACC10413-part1
ata-SAMSUNG_MZMPA016HMCD-000L1_S11BNEACC10413-part2
ata-SAMSUNG_MZMPA016HMCD-000L1_S11BNEACC10413-part3
ata-SanDisk_SSD_PLUS_240GB_184302A00387
ata-SanDisk_SSD_PLUS_240GB_184302A00387-part1
ata-SanDisk_SSD_PLUS_240GB_184302A00387-part2
ata-SanDisk_SSD_PLUS_240GB_184302A00387-part3
ata-SanDisk_SSD_PLUS_240GB_184302A00387-part4
ata-SanDisk_SSD_PLUS_240GB_184302A00387-part5
mmc-SDC_0x000000e2
mmc-SDC_0x000000e2-part1
wwn-0x5001b448b9edd143
wwn-0x5001b448b9edd143-part1
wwn-0x5001b448b9edd143-part2
wwn-0x5001b448b9edd143-part3
wwn-0x5001b448b9edd143-part4
wwn-0x5001b448b9edd143-part5
$ sudo dd if=rpi.img of=/dev/disk/by-id/mmc-SDC_0x000000e2 bs=4M status=progress

Windows

On Windows the easiest way to write an image to a sd card is to use a dedicated application like Balena Etcher.

Wavefolding Example

The following example calculates the spectrum of a sinusoidal function, folded with a sinusoidal transfer function:

Pitch:

Pre-Gain:

Time Domain:

Frequency Domain:

Using APIs with Python

Python & APIs

With the modules requests and json it is easy to get data from APIs with Python. Using the above introduced methods for sequencing, the following example requests a response from https://www.boredapi.com/:

#!/usr/bin/env python3

import requests
import json

response = requests.get("https://www.boredapi.com/api/activity")
data     = response.json()

print(json.dumps(data, sort_keys=True, indent=4))

# print(data["activity"])

Envelopes: ADSR

Envelopes are an essential part of control in electronic music and computer music. They are used to shape the characteristics of sound or other processes over time and are an integral part of synthesizers. Since they are that basic and versatile, they will be introduced in this early section.


One of the most common envelopes, already featured in early synthesizers and in prominent examples as the MiniMoog, is the ADSR envelope (Hiyoshi, 1979). It is comprised of four segments:

  • Attack

  • Decay

  • Sustain

  • Release

Attack time, decay time and release time can usually be controlled by the user via dials or sliders, whereas the sustain time depends on the duration a key is pressed and the sustain level may depend on the stroke velocity. Depending on the settings, the ADSR model can generate amplitude and timbral envelopes for slowly evolving sounds like strings or sounds with sharp attacks and release:

Your browser does not support the HTML5 canvas tag

Attack Time:

Decay Time:

Sustain Level:

Sustain Time:

Release Time:


When used in synthesizers, this envelope can be used to control the overall level or the timbre - for example through the cutoff frequency of a filter or by means of partial amplitudes.


References

1979

  • Teruo Hiyoshi, Akira Nakada, Tsutomu Suzuki, Eiichiro Aoki, and Eiichi Yamaga. Envelope generator. December 18 1979. US Patent 4,178,826.
    [details] [BibTeX▼]

Working with Groups

Creating Groups

Groups - or group nodes - can be a very useful concept for keeping track of the signal flow. Without any further actions, all nodes are placed in the default Group 1. Additional groups can be arranged regarding the order of execution. A new group can be added from sclang as follows:

~g1 = Group.new();

Adding Nodes to Groups

Synth nodes can be added to groups on creation or afterwards. Any existing node - in this case the ~osc node from the previous example <http://ringbuffer.org/computer_music_basics/SuperCollider/combining-nodes-in-supercollider/> - can be moved to a group using the following commands:

// make it the first node in the group
~osc.moveToHead(~g1)

// make it the last node in the group
~osc.moveToTail(~g1)

Relative Group Positions

As with nodes, further groups can be added in relation to existing groups. The following action makes sure that a new group will be placed after the previously defined group:

~g2 = Group.after(~g1);

Nested Groups

Groups can contain other groups, allowing a hierarchical structure of nodes:

~g3 = Group.head(~g2);

More on Groups

The group object allows many more actions. They are listed in the SC documentation on groups. After adding another group before the third one

~g4 = Group.before(~g3);

the server node structure looks as follows:

/images/basics/sc-group-nodes.png

The server does not know the groups by their variable names in sclang. Hence they are numerated. Node indices - or IDs - of groups can be assessed from the language:

~g1.nodeID;
~g2.nodeID;
~g3.nodeID;
~g4.nodeID;

Exercise

Exercise

Use groups to sort the nodes from the example in the section on Combining Nodes

Pure Data: Installing Externals with Deken

The basic install of PD is referred to as Vanilla. Although many things are possible with this plain version, some additional libraries are very helpful and there is a handful which can be considered standard.

Find and Install Extensions

PD comes with Deken, a builtin tool for installing external libraries. Deken can be opened from the menu of the PD GUI. On Linux installs it is located under Help->Find Externals. Deken lets you search for externals by name. The best match is usually found at the top of the results. cyclone is an example for a library with many useful objects:

/images/basics/pd-deken-1.png

Deken lets you select where to install externals in its Preferences menu. Everything will be located in the specified directory afterwards.


Add Libraries to Search Paths

Once installed, it may be necessary to add the individual libraries to the search paths. This is done in an extra step. On Linux installs, this can be found under Edit->Preferences->Path:

/images/basics/pd-deken-2.png

Digital Waveguides: Ideal String without Losses

Ideal String with two Delay Lines

Based on the previously introduced discrete solution for the wave equation, an ideal, lossless string can be implemented using two delay lines with direct coupling. The left-traveling and right-traveling wave are connected end-to-end. Output samples of each delay line are direcly inserted to the input of the counterpart:


The Excitation Function

The waveguides can be initiated - or excited - with any arbitrary function. This may vary, depending on the excitation principle of the instrument to be modeled. For a plucked string, the excitation can be a triangular function with a maximum at the plucking point $p$. Both waveguides (left/right travelling) are initiated with the same function:

$$y[i] = \begin{cases} \frac{i}{p} & \mbox{for } i \leq p \\ 1-\frac{i-p}{N-p} & \mbox{for } i > p \\ \end{cases}$$
    

Oscillation

When both waveguides are shifted by one sample each $\frac{1}{f_s}$ seconds, the ideal string is oscillating with a frequency of $f_0 = \frac{f_s}{N}$. It will oscillate continuously. In fact it is a superimposition of two oscillators with the waveform defined by the excitation function.



Once Loop Reflect