This example uses 30 channels to create a roomful of Barack Obamas.
This project is under construction and not yet available:
The original idea was to adapt Andy Farnell’s PSOLA granular timestretch algorithm to run using multiple voices – using Max mc object wrapper. After many attempts, the results just sounded like mostly noise.
So I started over, using a mc granular example that comes with Max8. In this example, a metro object triggers each new voice instance. I found that by altering the rate of that metro using a [drunk] object, ie., random-walk. It would give a good approximation of the natural cycles of density that happen in a crowd of people talking.
The other changes were adding wider ranges to the sliders and more control over the overall playback speed.
Also there was a problem in the example that prevented the voices from being recycled properly.
This project is under construction. And not yet available.
maxplanet.maxpat (Max control panel)
maxplanet.js (node.js maxAPI interface for web sockets)
to be done:
Need to get permission from ARCGIS to release this as open source.
Music and sound
Improve animation with better acceleration/deceleration in animations
Sonification of Mass Ave buses, from Nubian to Harvard.
Updated for Max8 and Catalina
This patch requests data from MBTA API to get the current location of buses – using the Max js object. Latitude and Longitude data is mapped to oscillator pitch. Data is polled every 10 seconds, but it seems like the results might be more interesting to poll at a slower rate, because the updates don’t seem that frequent. And buses tend to stop a lot.
This project uses version 3 of the API. There are quality issues with the realtime data. For example, there are bus stops not associated with the route. The direction_id and stop_sequence data from the buses is often wrong. Also, buses that are not in service are not removed from the vehicle list or indicated as such.
The patch uses a [multislider] object to graph the position of the buses along the route – but due to the data problems described above, the positions don’t always reflect the current latitude/longitude coordinates or the bus stop name.
You will need to replace the API key in the message object at the top of the patch with your own key. Or you can probably just remove it. The key distributed with the patch is fake. You can request your own developer API key from MBTA. It’s free.
Open the Max console window so you can see what’s happening with the data
click on the yellow [getstops] message to get the current bus stop data
Toggle the metro (at the top of the patch) to start polling
Turn on the audio (click speaker icon) and turn up the gain
Note: there will be more buses running during rush hours in Boston. Try experimenting with the polling rate and ramp length in the poly-oscillator patch. Also, you can experiment with the pitch range.
The Soundcloud client-id is embedded in scnode.js – you will need to edit this file to replace the worthless client-id with your own. To get a client ID you will first need a Soundcloud account. Then register an app at: http://soundcloud.com/you/apps
first time instructions
Open the Max patch: sc.maxpat
In the green panel, click on [script npm init]
In the green panel , click on [script install soundcloud-api-client]
Open the Max patch sc.maxpat
open the max.console window so you can see the API data
click [script start]
click the speaker icon to start audio
type something into the search box and press <enter> or click the button to the left to search for what is already in the box.
select a track from the result menu, wait for it to download and start playing
This implementation uses node.js for Max instead of Ruby to access the API. You will need set up a developer account with Spotify and request API credentials. See below.
Other than that, the synthesis code in Max has not changed. Some of the following background information and video is from the original version. ..
What if you used that data to reconstruct music by driving a sequencer in Max? The analysis is a series of time based quanta called segments. Each segment provides information about timing, timbre, and pitch – roughly corresponding to rhythm, harmony, and melody.
Edit spot1.js replacing the cliendID and clientSecret with your spotify credentials
node for max install instructions (first time only)
Open the Max patch: spotify-synth1.maxpat
Scroll the patch over to the far right side until you see this green panel:
Click the [script npm init] message – this initializes the node infrastructure in the current folder
Then click each of the 2 script npm install messages – this installs the necessary libraries
Open the Max patch: spotify-synth1.maxpat
Click the green [script start] message
Click the Speaker icon to start audio
Click the first dot in the preset object to set the mixer settings to something reasonable
open the Max Console window so you can see the Spotify API data
From the 2 menus at the top of the screen select an Artist and Title that match, for example: Albert Ayler and “Witches and Devils”
Click the [analyze] button – the console window should fill with interest data about your selection.
Note: if you hear a lot of clicks and pops, reduce the audio sample rate to 44.1 KHz.
Alternative search method:
Enter an Artist and Song title for analysis, in the text boxes. Then press the buttons for title and artist. Then press the /analyze button. If it works you will get prompts from the terminal window, the Max window, and you should see the time in seconds in upper right corner of the patch.
If there are problems with the analysis, its most likely due to one of the following:
artist or title spelled incorrectly
song is not available
song is too long
API is busy
The Mixer channels from Left to right are:
random octave synth
HPF cutoff frequency
You can also adjust the reverb decay time and the playback rate. Normal playback rate is 1.
Best results happen with slow abstract material, like the Miles (Wayne Shorter) piece above. The bass is not really happening. Lines all sound pretty much the same. I’m thinking it might be possible to derive a bass line from the pitch data by doing a chordal analysis of the analysis.
Here are screenshots of the Max sub-patches (the main screen is in the video above)
Timbre (percussion synth) – plays filtered noise:
Random octave synth:
Here’s a Coltrane piece, using roughly the same configuration but with sine oscillators for everything:
There are issues with clicks on the envelopes and the patch is kind of a mess but it plays!
Several modules respond to the API data:
tone synthesiszer (pitch data)
harmonic (random octave) synthesizer (pitch data)
filtered noise (timbre data)
bass synthesizer (key and mode data)
envelope generator (loudness data)
Since the key/mode data is global for the track, bass notes are probable guesses. This method doesn’t work for material with strong root motion or a variety of harmonic content. It’s essentially the same approach I use when asked to play bass at an open mic night.
Now that this project is running again. I plan to write additional synthesizers that follow more of the spirit of the data. For example, distinguishing strong pitches from noise.
Also would like to make use of the [section] data as well as the rhythmic analysis. There is an amazing amount of potential here.
Update: This method has limitations – see below. It is an alternative to CubicSDR. But not as robust especially with audio streaming. There is something wrong with the I/Q output from gqrx. Can’t get a consistent set of signals across the band.
How to build SoapySDR and CubicSDR from source in Ubuntu 20.04
After unsuccessful attempts to compile SoapySDR and CubicSDR on Mac OS and Windows, I was able to get it running in Ubuntu 20.04. The whole process took about 2 hours but could be done in less time if you know what you are doing.
It wasn’t really necessary to install CubicSDR to test SoapySDR. But CubicSDR is the only SoapySDR app that consistently works when it comes to devices, I/Q, files and TCP frequency control.
I also added the rtlsdr driver and the airspyhf driver. Instructions for rtlsdr are on the wiki. Instructions for airspyhf are below. You can add these drivers/libraries at any time, after SoapySDR is installed.
There were several missing libraries – described here.
Hamlib is an option in CubicSDR. It was included because we’re using it to send frequency data to the devices via rigctld. You’ll need to install hamlib before you try to compile CubicSDR
make sure to start the rigctl daemon before CubicSDR
rigctld -m 1 4532 &
And make sure there is some audio gain on CubicSDR
But… There is only one Max patch now and – after you start the rigcltd daemon, you need to run the python script in the max8radio folder like this:
The most important thing is to start CubicSDR first before you run the Max patch. Make sure to get everything working correctly. Then start the Max SDR.
In CubicSDR make sure you only have one “modem” running – otherwise the IQ data stream will be a complete mess. Als0 make sure that the audio sample rate in CubicSDR is set to 96 KHz. It will revert to 48 KHz. everytime you load the program. You can use the ‘bookmarks’ from a previous CubicSDR session (lower left part of the screen) to load a previous session with the same parameters.
These are the necessary settings:
Audio out: Existential Audio Inc. Blackhole 2 ch.
Audio sample rate: 96 KHz.
Rig Control Menu: enable rig and follow rig should be ‘checked’
Frequency should equal Center frequency and the V delta lock toggle should be on
Demodulator Gain level should be very low to prevent excess AGC (upper right corner)
Actually if you have loaded everything ok in a previous session, try this:
get the rigctld daemon running from the command
First thing: click ‘enable rig’ under rig control (this will probably load some crazy frequency like 145 Mhz
Then in the bookmarks (lower left) double click on your previous session, under ‘recents’ for example: 7007MHzI/Q – this should restore almost all the settings.
Then change the audio sample rate to 96 KHz if needed.
If the input to Max seems wrong, try clicking the S (over near the top right) to solo the modems. There may be more than one going.
Set audio input to Blackhole 2ch @ 96 KHz. (to match output from CubicSDR
Click the ‘flip IQ’ toggle – for some reason CubicSDR sends out the I/Q signal flipped
The arrow key tuning and all other tuning methods should work now
One of the problems with CubicSDR is sometimes you’ll accidentally change something and all the settings go crazy.
note: I tried a new version of CubicSDR (2.6) from the sdrplay website. It would not detect any connected devices or audio drivers.
Once you get it working, the audio quality inside Max is excellent – using the Airspy HF+