CPU usage of idle patches, tabread4~?
Hello there,
I started developing a sampler/looper with Purr Data a couple of months ago (and I've used this forum a lot!), to be used with a 8*8 MIDI launcher. In order to avoid audio drop-out and glitches, I spent the past 2 weeks separating the UI and DSP patches, communicating via OSC (so the UI can be launched with -nrt and -noaudio while DSP is using -rt -jack -nogui) (I'm on Debian 9.0).
To avoid dynamic patching and array creation, I then have 64 instances of the track's DSP abstraction, waiting for the UI to use them, even if only 3 or 4 tracks are actually used.
I find however that the idle DSP instance of Pd - all tracks' abstractions loaded, but not recording or playing any audio - uses 28-29% of my CPU when monitoring with Pd's load meter, while the idle UI instance uses only 5% (I'm on an old machine, but still). I have narrowed it down to the tracks abstractions, since I get only 5% CPU use (DSP side) when there is only one idle track patch instead of 64.
Looking deeper into it, I find that if I delete the 2 [tabread4~] objects (each track has 2 arrays for stereo) I significantly reduce the CPU load, from ~28% to ~17% with 64 idle patches. 17% is still significant, but I couldn't identify any other object with such an important impact.
Is it known that [tabread4~] (tabread~ does no better) uses significant CPU even if idle, both with a phasor~ at 0Hz or not connected at all to the phasor~? Is there a way to make it "sleep" completely? or is there no/little risk of audio drop-out if I create that tabread4~ object dynamically once I actually need the track?
The CPU load increases too ~40% when I turn DSP off, I guess because of errors or confused messages with empty arguments when processing audio signals.
Any other advice to reduce the CPU load is of course also welcome
Thank you!
Conceptual question about Step Sequencer using Tables, Arrays instead of text files
@seb_harmonik.ar Thanks for the link to your github folder. Wow, a lot of great stuff in there!
I looked at your sequencers, mseq and tseq, and of course I love that your sequence is written into an array. I posted a version of my sequencer for comparison, and they seem similar in some ways. For mine to work you need a folder called dseq in the folder of the sequencer and that's where text files will be written when a preset is stored. And I have space to save lots of presets.
In yours, it looks like when you hit the "store " button the sequence goes into a message box, and each track has it's own message box and arrays.
So let's say in your method, using arrays, I have 40 presets. Should I save each one to a message box, for each track. Then when I want to recall that track I send a message to all those message boxes and they send the info to their associated arrays? What would be the best way to take your concept of using arrays from tseq or mseq and build it out into an 8 or 16 track 64 step sequencer? That's what I'm trying to get at.
I think the method of using bits to store everything from every track into one huge array might take me a long time to figure out, so saving each track to a different array seems more appealing to me for now.
Thanks again for the input.
This Loop Machine (4 tracks) nearly perfect but.....
Hi @whale-av or somebody else,
https://github.com/undessens/Lucibox/tree/master/machines/1
This Loop Machine (4 tracks) nearly perfect but there are 2 points I would like to change. The points I would like to change:
-
The stop record button. Now you need to push the record button again to finish a record. I would like to change it by pushing the record button again (track 1) OR another record track (track 2). By pushing the record track loop 2 the record loop 1 will stop and the new record on loop 2 will start.
-
The stop/play button. To stop a loop you have to wait until the loop finish. When there are multiple loops and you will stop a loop you have to wait until the whole loop finish. To play the stopping loop you have to wait the whole loop start from the beginning. So a good solution is the mute a loop when you push the stop button. The stop/play all button works perfect, I am talking about the stop/play button on a loop track.
Can you help me with this? I am very new in Pure Data so I REALLY need your help.
Thank you for any help.
Changing pitch of sample using [soundfiler] with [tabplay~]
Hello
So I have run into a crossroads I'm not sure how to proceed. In this thread I included 2 versions of my abstraction. The first works 100%
The problems I am having showed its face when I decided to add pitch control to the mixer track which is the second version
of the abstraction.
Version 1 - OBSampleMixerV1.pd - This version works but without pitch control.
Version 2 - OBSampleMixerV2.pd - With pitch control additions to [soundfiler] using phasor and tabread4~
Note* the first version still exists inside V2 I reverted back for testing and disconnected the signal from tabread4~ on purpose,
I should first explain that this abstraction is one single track in the mixer. The track is cloned 16 times with the control of 4 banks giving and total of 64 tracks the patch is title "OverBlast" featuring a 16 step sampler sequencer.
I seam to run into issues with tabplay~ and tabread4~ in the first version no more is need after [soundfiler] so all sounds are played all the way through 100% of the time when the sequencer is playing. But since I need pitch control for each track I had to modify the abstraction to allow it.
Now my question is how would I go about incorporating this new addition to [tabplay~] instead of using [phasor] after [soundfiler] then [tabread4~] so on and so forth or is that even possible? basically I need to use [soundfiler] with [tabplay~] somehow. In the new version the playing of sounds is very inconsistent and often are not triggered at all aside from extra steps to find the end of the sample to stop playing the ect.
Warning this abstraction is not for the faint of heart. It applies some advanced audio concepts borrowed from a very old puredata tutorial. I heavily modified this tutorial to suit my needs.
PURE DATA: 22 Advanced Audio with [tabread4~]
By: cheetomoskeeto
I myself have been coding with puredata for about a year. So its not the cleanest but I have tried to keep it as neat as possible.
Any advice is much appreciated. Thank you in advance.
Dark-on-dark text in post editor
In Firefox + Ubuntu Studio + dark screen theme (blackbird), the post editor has a dark background and a dark font color.
When you use a dark screen theme, you find a LOT of websites with broken CSS this way -- either the font color is specified dark, but the background color is left default (becomes dark from the system theme), or the background color is specified light and the font color takes the system default (light).
Should be an easy fix.
hjh
Purr Data 2.8.0
Purr Data 2.8.0 has been released:
https://git.purrdata.net/jwilkes/purr-data#downloads
Changes:
- Constrained dragging. Version 2.8.0 adds the ability to drag iemguis, subpatches, graphs, grid, and Scope~, with a constraint either vertically or horizontally. Iemgui labels and the [cnv] object also allow constrained dragging.
Just move the pointer in the corners of the little "drag rectangle" that appears when the relevant iemgui is selected. (The [cnv] object and the red gop rectangle have two such "drag rectangles.") - Fixed bug with scalar events. In some cases opening a subpatch could unbind the event for the scalar.
- Improved help patch for [line] object. The new help file does a better job explaining the function of the 3rd inlet and specifies what happens when the grain size doesn't divide evenly into the total ramp duration.
- Added a "footgun" GUI preset. A user stated that Max/MSP lets the user selectively hide cords. Well, in Purr Data we let the user hide all cords and xlets with the "footgun" preset. The name is self-documenting but may come in handy for patches with so much spaghetti that the text in the object boxes is unreadable.
Please report all bugs on the issue tracker:
https://git.purrdata.net/jwilkes/purr-data/issues
Best,
Jonathan
[gme~] / [gmes~] - Game Music Emu
Allows you to play various game music formats, including:
AY - ZX Spectrum/Amstrad CPC
GBS - Nintendo Game Boy
GYM - Sega Genesis/Mega Drive
HES - NEC TurboGrafx-16/PC Engine
KSS - MSX Home Computer/other Z80 systems (doesn't support FM sound)
NSF/NSFE - Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound)
SAP - Atari systems using POKEY sound chip
SPC - Super Nintendo/Super Famicom
VGM/VGZ - Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro
The externals use the game-music-emu library, which can be found here: https://bitbucket.org/mpyne/game-music-emu/wiki/Home
[gme~] has 2 outlets for left and right audio channels, while [gmes~] is a multi-channel variant that has 16 outlets for 8 voices, times 2 for stereo.
[gmes~] only works for certain emulator types that have implemented a special class called Classic_Emu. These types include AY, GBS, HES, KSS, NSF, SAP, and sometimes VGM. You can try loading other formats into [gmes~] but most likely all you'll get is a very sped-up version of the song and the voices will not be separated into their individual channels. Under Linux, [gmes~] doesn't appear to work even for those file types.
Luckily, there's a workaround which involves creating multiple instances of [gme~] and dedicating each one to a specific voice/channel. I've included an example of how that works in the zip file.
Methods
- [ info ( - Post game and song info, and track number in the case of multi-track formats
- this currently does not include .rsn files, though I plan to make that possible in the future. Since .rsn is essentially a .rar file, you'll need to first extract the .spc's and open them individually.
- [ path ( - Post the file's full path
- [ read $1 ( - Reads the path of a file
- To get gme~ to play music, start by reading in a file, then send either a bang or a number indicating a specific track.
- [ goto $1 ( - Seeks to a time in the track in milliseconds
- Still very buggy. It works well for some formats and not so well for others. My guess is it has something to do with emulators that implement Classic_Emu.
- [ tempo $1 ( - Sets the tempo
- 0.5 is half speed, while 2 is double. It caps at 4, though I might eventually remove or increase the cap if it's safe to do so.
- [ track $1 ( - Sets the track without playing it
- sending a float to gme~ will cause that track number to start playing if a file has been loaded.
- [ mute $1 ... ( - Mutes the channels specified.
- can be either one value or a list of values.
- [ solo $1 ... ( - Mutes all channels except the ones specified.
- it toggles between solo and unmute-all if it's the same channel(s) being solo'd.
- [ mask ($1) ( - Sets the muting mask directly, or posts its current state if no argument is given.
- muting actually works by reading an integer and interpreting each bit as an on/off switch for a channel.
- -1 mutes all channels, 0 unmutes all channels, 5 would mute the 1st and 3nd channels since 5 in binary is 0101.
- [ stop ( - Stops playback.
- start playback again by sending a bang or "play" message, or a float value
- [ play | bang ( - Starts playback or pauses/unpauses when playback has already started, or restarts playback if it has been stopped.
- "play" is just an alias for bang in the event that it needs to be interpreted as its own unique message.
Creation args
Both externals optionally take a list of numbers, indicating the channels that should be played, while the rest get muted. If there are no creation arguments, all channels will play normally.
Note: included in the zip are libgme.* files. These files, depending on which OS you're running, might need to accompany the externals. In the case of Windows, libgme.dll almost definitely needs to accompany gme(s)~.dll
Also, gme can read m3u's, but not directly. When you read a file like .nsf, gme will look for a file that has the exact same name but with the extension m3u, then use that file to determine track names and in which order the tracks are to be played.
Multiple track audio to MIDI signal
Hi!
Well first of all I should say that I'm very new to Pure Data, and this is the first time I'm using it on a real project. It's still a bit confusing for me, and there is a kind of complicated setup for what I'm trying to do,
Short question (my take on the issue):
Is there a way to assign a Pd patch to separate tracks in a DAW,? Like making the patch into a plugin.
Or is there an audio device that I can use with my DAW that supports multiple output channels, so I can assign each track to the desired patches within Pd.
Long explanation:
For this project I'm building a live music+visuals set with a band. I use a DAW to receive the sound of a full band via mic and line inputs on an USB interface. I also use a built-in sampler and synthesizer to play on certain songs and interact with the band, while sometimes also playing plain audio files that are too on separate tracks.
For the visuals I use Resolume Arena. As I kind of also play in the band (with the synth and the sampler), I need to be able to operate the visuals in a very simple yet interesting way, so audio-responsive effects are a nice option. I want to be able to assign as many parameters as I can to be responsive to the individual audio tracks that come from the band and my instrument. So my idea is to use the MIDI mapping feature on Resolume, which gives me many options.
On Pd I found a patch that takes audio signals and interprets them via [fiddler~] giving out MIDI. Now I only need to assign individual instances of the patch to individual tracks, and then restrict each of their MIDI output signals to a different note range so I can map them to Resolume.
In a perhaps less confusing way, this is what I need:
Starting point: live audio feed and audio files on DAW tracks
Ending result: A distinct MIDI signal for each track.
I hope this is understandable. If you can come up with any other way of achieving the main goal of this proyect (make audio responsive visuals on Resolume via MIDI mapping) and would like to share it, I would really appreciate your ideas.
Thanks in advance for your help!
How to maintain pitch, when playing an audio file with a 44.1k samplerate when PD samplerate is 48k
@ablue It is possible to up / downsample internally in Pd using [block~]..... but only in multiples of 2.... so not useful here.
In extended you could simply change the samplerate for Pd for each track played.......... https://forum.pdpatchrepo.info/topic/10302/openpanel-and-readsf-play-audio-file-detuned-and-slowed-down
and of course that can still be done for vanilla if all the externals are available (compiled) for your os. Try "find externals" "deken" in Pd to see if you can get them. Very unlikely for iOS I think.
The patch I posted there simply gets info about the file to be played and changes the Pd samplerate before playing it. It cannot deal with playing two tracks at different rates at the same time. Sound generation within Pd... [osc~] etc would be unaffected though...... which is all good.
Changing the samplerate of Pd might not change the soundcard rate in iOS (unsure). The os might do the up / downsampling itself.
If you cannot use the externals from extended then I think you will have to add the samplerate info to all your tracks..... in their names........ like this...... "my-track 48.wav" and extract the 48 or 44 value to do the same.
You can still send the [audio-dialog( message to Pd in Vanilla....... so that part of this patch will still work........ set_audio_parameters.pd
There is a complete list of the values that need to be set by the message in there as well, and by clicking the [audio-properties( message at bottom right you can get your current parameters........ then change the sample-rate.... then send the new message back to Pd.
Or you could load tracks into a table and calculate the new values for the table as they are loaded..... horrible..... and you would still need to know the track samplerate.
Probably easier to just re-sample all the audio for your project first, at 48K, using another program.
David.
to randomly rearrange a short speech
@nico If there are 17 tracks this could be the patch without modification......... tracks random.zip
Just delete [trackme x] objects if you have less than 17....... or add more if you need. Then change the [17( message at the top of the patch to the number you have.
I have not included any tracks. Give your tracks the names 1.wav, 2.wav .... etc, in the same folder as the patch and it will work. Modify it as you wish.
(It has other bits you don't need....... but be careful removing any. I have just disconnected keyboard input rather than deleting it)
[readsf~] is fine on a modern computer...... and this patch only reads one file at a time.
It should be perfect in Pd Extended.
For vanilla I have made a [pvu~] object for metering that is not perfect but it works. It is not necessary for functionality though.
David.