ep-4yy13 DSP – week 7

frequency domain

transforming signals

  • DFT, FFT, STFT
  • The FFT produces a stream of complex numbers representing energy at frequencies across the spectrum
  • The length of the FFT determines the frequency resolution (number of bins)
  • Increasing length of FFT frame degrades resolution in time domain (rhythmic accuracy)
  • Amplitude = root of (r*r) + (i*i)  = magnitude
  • Phase = arctangent of i/r = angle

Practical Applications

  • Convolution/Deconvolution
  • Analysis
  • Spectral processing (pitch and timbre)
  • Amplitude processing: noise gates, crossovers
  • phase vocoder
  • radio

Examples

  • Max/MSP tutorials 25-26
  • Max/MSP Example DSP patches (in Extras | ExamplesOverview | MSP | FFT fun
    • convolution workshop
    • Forbidden planet
  • Fourier Filter (Vetter)
  • fft-tz2 (basics, SSB ring modulator)
  • fplanet-tz.maxpat: hacked version of forbidden-planet example which uses granular indexing to do spectral convolution and make spaceship sounds. To use patch: 1 ) turn on audio, 2) then press message boxes inside the green panel
  • fp-fft-tz.maxpat: pfft~ subpatch for above
  • fourierfilter (folder) containing fourierfiltertest.maxpat: Katja Vetter’s complex spectral filter example
  • Tristan Jehan’s frequency detector object
  • Little Tikes piano: https://reactivemusic.net/?p=6993
  • Helicopter frame rate video: http://www.youtube.com/watch?v=jQDjJRYmeWg
download example Max patches here:
Resources

Assignments

See notes from previous weeks: https://reactivemusic.net/?p=10109 

 

 

 

ep-4yy13 DSP – week 6

Stop the experimental music

(click the picture)

from http://emoctv.tumblr.com

DSP – according to the Arctic Monkeys…

The time domain:

The frequency domain:

Samples, impulses, and convolution

(in the time domain)

  • Decomposition
  • Unit impulse (delta function)
  • convolution (from the input side and output side)
  • filters
Reference: http://www.dspguide.com “The Scientist and Engineer’s Guide to DSP”, By Steven Smith – chapters 6-7

Clocks

Time, under a microscope.

Granular synthesis

Audio under a microscope.

Andy Farnell, “Designing Sound” http://aspress.co.uk/sd/index.php

Chapter 16.7 Methods “Granular” p. 257

Chapter 13 “Shaping Sound” p. 205

Destroying information

Abstract is what remains after shedding details.

Example Max patches:

  • timestrech3.maxpat
  • nothingness.maxpat
[wpdm_file id=16]

Assignment:

See notes from last week. https://reactivemusic.net/?p=10059

Work through the convolution examples on your own. Its important to have a physical concept of signals, in various transformations. Become a wave. Have an out of body experience. Take a good look at yourself.

ep-4yy13 DSP – week 5

transforming music into music

Examples

Notes

  • Solving problems
  • Exploration
  • Stories

Assignments

Mystery field recording: (email to me this week)

  • Record a very short sound clip (less than 15 seconds)
  • It should be something that you hear, not something you produce – for example, a fire-truck, a refrigerator, the wind…
  • Please don’t tell me where the sound came from. We will try to guess. When you send the file, just have your name on it. For example: field-recoding-keithMoon.mp3
  • Alternative: Record an impulse response in an interesting space. We will try to guess the space. The impulse can be anything, for example: hand clap, yelling “hello”, a trumpet.
  • Extra credit – transcribe your recorded event. For example, what chord or rhythms do the machines in a coffee shop produce?
  • Email a link or attachment to: [email protected]

Composition: Sound-byte (due March 17th)

  • The sound-byte is a short audio clip of speech.
  • The speech can come from anywhere. Something familiar, something famous, something unusual.
  • Every sound in the composition is derived only from the sound-byte. You can use any tool or method.
  • The sound-byte in its original form should occur somewhere in the piece
  • Duration: roughly 2-3 minutes?  That is up to you.

Music from the future:

Please send me a link to your future music piece – sometime before the end of the semester

More conversations with robots in Max

Using Google speech API and Pandorabots API

(updated 1/21/2024)

all of these changes are local – for now.

replace path to sox with /opt/homebrew/bin/sox in [p call-google-speech]

Also had to write a new python script to convert xml to json. Its in the subfolder /xml2json/xml4json.py

The program came from this link: https://www.geeksforgeeks.org/python-xml-to-json/

Also inside [p call-pandorabots] the path for this python program had to be explicit to the full path on the computer. this will vary depending on your python installation.

Also, note that you must install a dependency with pip:

pip install xmltodict

After all that I was actually able to have a conversation. These bots seem primitive, but loveable, now compared to chatGPT. Guess its time for a new project.

Also the voice selection for speech synth is still not connected

(updated 1/21/2021)

This project is an extension to the speech-to-text project: https://reactivemusic.net/?p=4690 You might want to try running that project first to get the Google speech API running.

features

  • Everything runs in one Max patch
  • menu selection of chat bots and voices (currently disabled)
  • filtering of non speakable text (like HTML tags)
  • python script now runs under current directory of patch using relative path
  • refinements to recording and chatbot engines

download

https://github.com/tkzic/internet-sensors

folder: google-speech

files
main Max patch
  • robot-conversation7.maxpat
abstractions and other files
  • clean-html.js
  • xml2json/xml2json.py
  • JSON-google-speech.js
  • JSON-pandorabot.js
  • ms-counter.maxpat (timer for recording messages)
  • pandorabots.txt
Max external objects
external programs:

sox: sox audio conversion program must be in the computer’s executable file path, ie., /usr/bin – or you can rewrite the [sprintf] input to [aka.shell] with the actual path. In our case we installed sox using Macports. The executable path is /opt/local/bin/sox – which is built into a message object in the subpatcher [call-google-speech]

get sox from: http://sox.sourceforge.net

Instructions

  • Open robot-converstaion7.maxpat and turn on audio
  • select chatbot as destination
  • Press the spacebar to start recording.
  • Ask a question.
  • Press the spacebar to stop recording. 

notes

Need to fix the selection of voices.

revision history

  • 1/21/2021: complete rewrite for Max8 and Catalina
  • 4/24/2016: need to have explicit path to sox, in the call-google-speech subpatch. In my Macports version the path is /usr/local/opt/bin/sox.
  • 6/6/2014: re-added missing pandorabots.txt (list of chatbots) – also noticed that pandorabots.com was not available. May need to look for another site.
  • 5/11/2014: The newest version requires Max 6.1.7 (for JSON parsing). Also have updated to Google Speech API v2.
  • Note: Instructions for getting a real key from Google – which will need to be inserted into the patch.  http://www.chromium.org/developers/how-tos/api-keys – so far we have been getting by with common keys from a github site (see notes in next link)

Also please see these notes about how to modify the patch with your key – until this gets resolved: https://reactivemusic.net/?p=11035

ep-4yy13 DSP – week 2

new composition tools

from various artists

tools that make tools

 

ep-4yy13 DSP – week 1

Digital Signal Processing, theory and composition

Spring 2014

teacher: Tom Zicarelli – http://tomzicarelli.com

You can reach me at:  [email protected] 

Office hours: Wednesday 2:30-3:30 PM, at the EPD office #401 at 161 Mass Ave. Please email or call ahead.

Assignments and class notes will be posted to this blog: https://reactivemusic.net before or after the class. Search for: ep-4yy13 to find the notes

Examples, software, links, and references demonstrated in class are available for you to use. If there is something missing from the notes,  please ask about it. This is your textbook.

Syllabus:

The focus will be on composition – and sparking your imagination. Composition plus science fiction. After you take the course, you will have composed several new pieces. You might design a musical instrument. You will have opportunities to solve problems.  You will become familiar with how artists use DSP to compose music and to build musical instruments. You will be exposed to to a world of possibilities – which you may embrace or reject.

In particular we will compose, by improvising, using tools that transform signals and movement. For example, generative music.

We will explore a range of topics in DSP, and have opportunities to use them in projects. Most applications of DSP involve one or more of the following actions using signals:

  • analysis
  • measurement
  • transformation

For example, statistics is a form of analysis.

Topics: (subject to change)

  1. Future music tools
  2. Improvisation
  3. Signals: the time domain – granular synthesis
  4. Signals: the frequency domain – convolution
  5. Problem solving, prototyping, portfolios
  6. How to get ideas
  7. Sensors
  8. Demodulation and reversibility
  9. Artists
  10. Voices
  11. Music from data – sonification, Internet API’s
  12. Statistics
  13. Radio waves and ultrasound
  14. Visualization

Grading:

Grades will be based on compositions, several small assignments, and class participation. Please see Dr. B’s EP-4yy13 syllabus for details. I encourage and will give credit for: collaboration with other students, outside projects, performances, independent projects, and anything else that will encourage your growth and success.

Assignment:

Go to the future. Make music. Bring it back to the present.

It should be a very short piece or an excerpt. Less than two minutes. It can be a remix of a song that you believe represents a future direction in music. Near future or distant future – your choice. Use any tools to create the music. The result: an audio file (mp3) or a link to audio or video on the Internet, or a live performance in class

Due: in 2 weeks.

Software Defined Radio in Pd

This is based on the Max tutorials. I have only written one external (for Soft66LC2). But everything seems to be working well with minimal filtering. After watching the video, I think the next feature should be an AGC (automatic gain control) on the input stage.

converting IQ audio files using sox

To get information about a file:

# sox --i 10meter96.wav

Input File : '10meter96.wav'
Channels : 2
Sample Rate : 96000
Precision : 16-bit
Duration : 00:00:16.50 = 1584387 samples ~ 1237.8 CDDA sectors
File Size : 6.34M
Bit Rate : 3.07M
Sample Encoding: 16-bit Signed Integer PCM

#

To convert the sample rate:

# sox 10meter96.wav -r 44100 10meter44.wav

More useful hints about sox by Selvaganeshan at “The Geek Stuff”

http://www.thegeekstuff.com/2009/05/sound-exchange-sox-15-examples-to-manipulate-audio-files/

Here are the commands that worked to get the raw IQ data from rtl_sdr into Max

rtl_sdr -f 94900000 -s 1024000 -g 50 iq.raw

To convert the above to 96k 16bit wav format

sox -e unsigned-integer -r 1024k -t raw -b 8 -c 2 iq.raw -r 96k -b 16 iq.wav

Note: I could not get the above conversion to work with device sampling rates below 1024k. Didn’t try anything higher.