Hiss when using samples in partikkel

Hi everyone,

I’ve been learning Csound for a month and I’m not used to coding, so I really am a newbie.

When experimenting with the partikkel opcode using a sample as the waveform, some very present hissing artefacts appeared and I don’t have a clue where it comes from.

They seem to appear when the transposition is randomized, even if I transpose it half on octave higher. When the transposition is fixed (kwavefreq = a number), there is no hiss, even if I transpose it 10 octaves higher. The hiss follows the same movement as the sample transposition (iwavfreqstarttab, iwavfreqendtab). It appears randomly, which is very weird.
Btw, I put 1/(tableng(giFile)/sr) at the kwavekey parameter.

I tried changing the sampling rate (from 44100 Hz to 192000 Hz), using a sample which hadn’t been rendered with Csound, using a different computer, a different sound card, changing the file function table size (0, the exact file length, 2^24), installing an older Csound version, running from the terminal, rendering, the artefact is still there.

Does anyone know what could be related to that hissing issue ?
Thanks a lot,
Jacques

1 Like

I can’t help with your problem, but I can be cheeky and ping the author @Oeyvind to see what he thinks :+1:

Hi Rory,

Thx a lot ! I don’t want to cause any trouble

Thank you for Cabbage btw, an amazing discovery !!

All the best

Hi Jacques, Hi Rory.
All good here, I am happy to get a nudge when there is something I can help with.

Jacques, could you post a zip with the csd and the sound file you use? Then I can run it here and see what is up.

I am working on a non-electronic thing (intense, but no rush) at the moment, so might not check email every day. If I am late to reply, that is probably the reason :wink:

Øyvind

Hi Øyvind,

Thank you for your reply. I won’t be waiting for a quick answer :slight_smile:

It looks like I can’t share any file as a new user… so here is wetransfer and dropbox links :confused:
https://we.tl/t-vAbAEwk3GY

Btw, I discovered partikkel from the sound artist Lee Fraser and it’s what made me want to learn CSound. It’s so powerful and so well-thought, thank you for that

Jacques

Hi
I looked at it, and found a possible cause for the problem.
Partikkel reads mono sound sources, and you have loaded a stereo file. This might seem innocent, but it can sometimes cause problems.

What follows is a lengthy explanation of what happens. You do not need to read it all, but I thought it could be interesting. A solution follows at the end.

When you use gen 01 to load a file, you will normally usually read all channels (as you have done). This works well if you then play the file with a stereo audio playback method. However, the samples in a stereo file are stored in interleaved manner: The first value of the left channel, then the first value of the right channel, then the second value of the left, and the second value of the right. When you play back the table with a stereo playback method (like loscil for example), it will read it interleaved and put all the left channel values to the left audio output and all the right channel values to the right audio output, so it is played back correctly. Now, when you try to play this table of audio data with a mono playback method (like partikkel, or a simple table playback for example), then it will play all the samples in the order they are stored, …in effect switching between left and right at audio rate. If there is relatively little difference between the two channels, you will simply hear the original sound at half the speed (pitch one octave down) and you might not notice any artifacts (you will get almost like a sample and hold type of thing, we could say it is somewhat similar to downsampling by a factor of two). BUT, if the left and right channel are very different, like in your file, the artifacts are more pronounced. We get a lot of discontinuities in the waveform then it flips between the two channels, … so we also get a lot of extra high frequencies (in the worst case square-wave-like distortion at the Nyquist frequency). With untransposed playback, it might not be too obvious, but it will be there. When you transpose the signal, these effects will start to be more prominent, and when you do pitch sweeps from one transposition to another they will sometimes come out very clearly - like in your example.

So, solution 1:
modify the line
gifile ftgen 0, 0, 0, 1, “N_01_220Hz.wav”, 0, 0, 0
so that it only reads the left channel of the file
gifile ftgen 0, 0, 0, 1, “N_01_220Hz.wav”, 0, 0, 1
or only the right channel
gifile ftgen 0, 0, 0, 1, “N_01_220Hz.wav”, 0, 0, 2
Then your csd should sound fine. It will be one octave higher than what you had in your example. It makes sense to use the same sr as what you had in your source audio file, otherwise you will also get transposition due to the sr mismatch.

Solution 2:
Mix the two channels of your file to make a mono version, and load it as you have done
gifile ftgen 0, 0, 0, 1, “mono_version.wav”, 0, 0, 0

Solution 3 (to keep your interesting stereo beating effects:
Load the left and right channels into separate tables
gileft ftgen 0, 0, 0, 1, “N_01_220Hz.wav”, 0, 0, 1
giright ftgen 0, 0, 0, 1, “N_01_220Hz.wav”, 0, 0, 2
and then use two instances of partikkel to play back the audio, one using gileft and one using giright as the source waveform. Then you would want to use the same random values for both partikkel instances, so they would both transpose the source audio in the same way.
This third option is much more work of course. You would also need to consider how you handle the stereo output from each of the partikkel instances (partikkel will read mono audio but produce stereo output due to the channel masking etc). It is all doable if you decide that you need it.

Don’t hesitate to ask for clarification if anything is unclear. It was a good riddle to solve, and I did not immediately spot the cause of the problem :wink:

all best
Øyvind

1 Like

Hi Øyvind,

Wow thanks a lot for your time. Now I know how to avoid it and why it happened, problem solved :slight_smile:

Thank you for your explanation, many things got suddenly clearer. Finding the right information isn’t always easy since I’m learning Csound by myself but that makes it even more rewarding !

I was planning to work on using multiple instances of partikkel, your suggestion may be a good starting point.

Wish you best of luck for your non-electronic thing

Jacques