Hradio
Ok thanks for the explnanation.
In fact, that is exactly what Tcihan said that I want to do. But I proceed step by step as I am a novice.
Clearly I want to have a volume controller for all the sound, let's say a general volume controller. Like when I listen to my music, if I want it louder or not.
And moreover I want a smooth transition between the different sounds.
For example let's say I have clicked on the first box ti listen the Asia sound, then I change my mind and want to hear the France sound, so I clicked on the second box. Here I want the Asia sound to disappear as the same time the France sound appears.
I really don't know if I am clear enough, sorry...
ALSA
below you'll find my lsmod info. echomixer, the alsa-toolkit utility for echo audio products did work after doing [ # alsaconf ] however, I tried to test my config simply by doing this;
# aplay -vv *
ALSA lib confmisc.c:670:(snd_func_card_driver) cannot find card '0'
ALSA lib conf.c:3500:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
ALSA lib confmisc.c:391:(snd_func_concat) error evaluating strings
ALSA lib conf.c:3500:(_snd_config_evaluate) function snd_func_concat returned error: No such device
ALSA lib confmisc.c:1070:(snd_func_refer) error evaluating name
ALSA lib conf.c:3500:(_snd_config_evaluate) function snd_func_refer returned error: No such device
ALSA lib conf.c:3968:(snd_config_expand) Evaluate error: No such device
ALSA lib pcm.c:2143:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:550: audio open error: No such device
So therer is still a missing piece.
Module Size Used by
snd_layla24 36356 0
snd_seq_oss 40084 0
snd_seq_midi 9792 0
snd_seq_midi_event 8160 2 snd_seq_oss,snd_seq_midi
snd_seq 60456 5 snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_rawmidi 28992 2 snd_layla24,snd_seq_midi
snd_seq_device 9708 4 snd_seq_oss,snd_seq_midi,snd_seq,snd_rawmidi
firmware_class 11744 1 snd_layla24
snd_pcm_oss 52032 0
snd_mixer_oss 20704 1 snd_pcm_oss
snd_pcm 91396 2 snd_layla24,snd_pcm_oss
snd_timer 26500 2 snd_seq,snd_pcm
snd 65908 9 snd_layla24,snd_seq_oss,snd_seq,snd_rawmidi,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
soundcore 11204 1 snd
snd_page_alloc 11304 2 snd_layla24,snd_pcm
ALSA
Dunno what snd_pcm is returning there, but you should see a separate driver for the Layla24
like this
$ lsmod
snd-seq-midi 5152 0 (unused)
snd-virmidi 2080 0
snd-seq-virmidi 5128 0 [snd-virmidi]
snd-seq-midi-event 6240 0 [snd-seq-midi snd-seq-virmidi]
snd-seq 48784 0 [snd-seq-midi snd-seq-virmidi snd-seq-midi-event]
snd-layla24 149732 3 <--------*here*
snd-pcm 85860 2 [snd-layla24] <---and pcm is using it
You don't have to recompile kernel or anything, find a driver and use insmod
Apparently there's a utils package at Alsa Project website for the Echo Layla24 that sets up everything. Have you tried that one?
also, there's an ALSA Wiki up now that may help you
Anyone working with chiptunes or console emulation?
Well for now I'm concerned about getting an authentic sound without worrying too much about emulating the specific operation of the hardware. I also want to add a few extras that the original didn't have, like vibrato, sweeping of the triangle channel, and maybe some other small odds and ends.
The pulse channel sound is simple to emulate, especially if you aren't concerned about timing their length & envelope data against other components, like the frame counter or interrupt lines. The triangle is a bit trickier to get authentic.
The noise channel is particularly difficult to emulate, at least for the inexperienced like me. The NES noise sound in itself is easy to reproduce as a sample using 4bit level quantized noise. The 2A03 actually uses a long shift register and a XOR gate to generate a new pseudo-random bitstream for noise samples. Rather than use my very own enveloping like I did for pulse and triangle channels, I will have to reproduce the native specs of the counters/timers and decay envelope modes, especially to get the looped-decay noise channel mode to sound authentic.
So I guess I will be using some of the same dataflow and control logic that the hardware uses, but I want to cut as many corners as I can right now, especially where I can easily provide userdata through the GUI instead of poking 6502 assembly. Then I can use my own, simpler methods for programmable manipulation of all of the inputs, but ideally get the same-sounding output as I would programming the actual hardware.
Right now I'm going through this document to try and get a full picture of the hardware:
http://nesdev.parodius.com/NESSOUND.txt
I believe that has everything needed to directly emulate the channels, I just gotta keep studying the hell out of it until I can determine all of the specifics on timing, mode switching, sample sizes and such.
The zenpho patch looks similar to what I want to use eventually for making real music, I'll probably refer to that a few times. I see he uses a completely diferent PWM routine than I do. Once I get the NES channels sounding properly, I plan to keep adding voices from other old sound chips I enjoy along with more extras and use it as my main synth.
Thanks alot for that headlessbarbie link. Really amazing stuff. I've had thoughts about later on trying to emulate the 2A03 hardware directly, so that I possibly could put pd on a board with a fast CPU (maybe a SuperH) that would be small enough to fit in a NES cart. Then I could use pd as just an interpreter between the user and the real live sound hardware.
Timbre conversion
@daisy said:
I have read some where that "if a voice is at same pitch and same loudness and still if one recognize that two voices are different , it is becuase of TIMBRE (tone quality)". (I agree there are other features as well who need to consider).
Timbre is another word for spectrum. The spectrum of a sound is the combination of basic sine waves that are mixed together to make it. Every sound (except a sine wave) is a mixture of sine waves. You can make any sound by adding the right sine waves together. This is called synthesis.
@daisy said:
First Question:
So how we can calculate the TIMBRE of voice? as fiddle~ object is used to determine the pitch of voice? what object is used for TIMBRE calculation?.
[fft~] object splits up the spectrum of a sound. Think of it like a prism acting on a ray of light. Sound which is a mixture of sines, like white light, goes in. A rainbow of different colours comes out. Now you can see how much red, blue, yellow or green light was in the input. That's called analysis.
So the calculation that gives the spectrum doesn't return a single number. Timbre is a vector, or list of numbers which give the frequencies and amplitudes of the sine waves in the mixture. We sometimes call these "partials".
If you use sine wave oscillators to make a bunch of new sine waves and add them together according to this recipe you get the original sound back! That's called resynthesis.
@daisy said:
Second Question:
And how one can change TIMBRE? as pitch shifting technique is used for pitch? what about timbre change?Thanks.
Many things change timbre. The simplest is a filter. A high pass filter removes all the low bits of the spectrum, a bandpass only lets through some of the sine waves in the middle, and so on...
Another way to change timbre is to do analysis with [fft~] and then shift some of the partials or remove some, and then resynthesise the sound.
@daisy said:
I have a kind of general idea (vcoder). but how to implement it? and how to change formant?.
A vocoder is a bank of filters and an analysis unit. Each partial that appears in the analysis affects the amplitude of a filter. The filter itself operates on another sound (often in real time). We can take the timbre of one sound by analysing it and get it to shape another sound that is fed through the filters. The second sound takes on some of the character of the first sound. This is called cross-synthesis.
/doc/4.fft.examples/05.sheepgoat.pd
Help -> 7.Stuff -> Sound file tools -> 6.Vocoder
Problem compiling external on Windows
Hey,
thanks to everyone who responded to my posts both here and in the mailing list. Since then, I've figured out how to compile externals written in C using Microsoft Visual C++ 2005. There's more to document, however, such as how to compile externals using some of the other Windows compilers (Borland, djgpp, etc.), and also how to compile externals written in C++ in Windows. But one thing at a time.
one little thing to note... steps 4 and 7 may seem a little roundabout, but they account for the fact that MSVC sometimes has trouble with spaces in directory names (eg. C://Program Files/). If anyone knows how to override this behavior, post a reply, and I'll try to simplify the steps accordingly.
Updated June 29, 2007:
use [b]C://Progra~1/[/b] instead of [b]C://Program Files/[/b],
use [b]C://Docume~1/[/b] instead of [b]C://Documents and Settings/[/b], etc.
So, without further ado...
How to compile a pd external written in C using Microsoft Visual C++ 2005:
Compared to Windows, linux offers a much more user-friendly environment for compiling pd externals. However, with a little patience, a usable environment can be set up in Windows, and the good news is that everything you need is available for free. There are several reputable Windows-compatible C/C++ compilers out there, but here I'll discuss compiling externals with Microsoft Visual C++ 2005 (MSVC for short).
1. Download and Install Microsoft Visual C++ 2005 Express Edition.
a. Click the link above, then click Go! in the Visual C++ box.
b. Run vcsetup.exe to install the program
(the setup wizard should guide you through the process).
2. Download [url=http://download.microsoft.com/download/7/7/3/7737290f-98e8-45bf-9075-85cc6ae34bf1/VS80sp1-KB9267
]Visual C++ 2005 Express Service Pack 1.
a. Click the link above to download the Service Pack.
b. Run VS80sp1-KB926748-X86-INTL.exe to install the program.
3. Create a new project:
a. Open Visual C++.
b. Open the New Project window (Ctrl+Shift+N).
c. In the Project Types pane, select Visual C++.
d. In the Templates pane, select emptyproj.
e. Enter object name (helloworld).
f. Leave Create directory for solution unchecked, and click OK.
4. Import the pd header file:
a. Get m_pd.h here, or, using pd-vanilla (not pd-extended):
1. Open Windows Explorer or My Computer.
2. Navigate to the pd/src/ directory on your system.
3. Open m_pd.h in a text editor (file type is: C/C++ header).
b. Select all (Ctrl+A).
c. Copy selection to the clipboard (Ctrl+C).
d. Back in Visual C++, open the New File window (Ctrl+N).
e. In the Categories pane, select General.
f. In the Templates pane, select Text File, and click Open.
g. Copy the contents of m_pd.h into the editor window (Ctrl+V).
h. Open the Save File As Window (Ctrl+S).
i. Save as m_pd.h.
j. From the File Menu, select Move m_pd.h into; select helloworld.
5. Write the source code for the external in C.
a. Open the New File window (Ctrl+N).
b. In the Categories pane, select General.
c. In the Templates pane, select Text File, and click Open.
d. Write your source code in the editor window.
The following example is taken from the tutorial by Johannes M. Zmoelnig.
#include "m_pd.h"
static t_class *helloworld_class;
typedef struct _helloworld {
t_object x_obj;
} t_helloworld;
void helloworld_bang(t_helloworld *x)
{
post("Hello world !!");
}
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) {
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
}
6. Save and import the source code into the project:
a. Open the Save File As Window (Ctrl+S).
b. Save as helloworld.c.
c. From the File Menu, select Move helloworld.c into; select helloworld.
7. Access the pd library file:
a. Open Windows Explorer or My Computer.
b. Navigate to the pd/bin/ directory on your system.
c. Right-click on pd.lib (file type is: Object File Library) and select Copy.
d. Navigate to the C://TEMP/ directory on your system.
e. Paste the copy of pd.lib in the C://TEMP/ directory (right-click or Ctrl-V).
8. Set configuration properties:
a. Set configuration type to .dll:
1. Back in Visual C++, open the helloworld Property Pages window (Alt+F7).
2. In the left pane, select Configuration Properties >> General.
3. In the right pane, under Project Defaults, click on
Configuration Type, and select Dynamic Library (.dll)
(using the arrow on the right).
b. Add MSW to preprocessor definitions:
1. In the left pane, select
Configuration Properties >> C/C++ >> Preprocessor.
2. In the right pane, type MSW in the Preprocessor Definitions field.
c. Tell compiler which language to use:
1. In the left pane, select
Configuration Properties >> C/C++ >> Advanced.
2. In the right pane, select Compile As.
3. Select Compile as C Code (/TC) by clicking the arrow on the right.
d. Tell linker where to find pd.lib:
1. In the left pane, select Configuration Properties >> Linker >> Input.
2. In the right pane, select Additional Dependencies and enter
C://TEMP/pd.lib.
e. Tell linker to export the setup function:
1. In the left pane, select
Configuration Properties >> Linker >> Command Line.
2. In the right pane, type
/export:helloworld_setup in the Additional options field.
3. Click OK.
9. Compile and link:
a. Use the Build Solution command (F7).
10. Copy the new helloworld.dll file into pd.
a. Open Windows Explorer or My Computer.
b. Navigate to the
My Documents/Visual Studio 2005/Projects/helloworld/Debug/
directory on your system.
c. Right-click on helloworld.dll (file type is: Application Extension)
and select Copy.
d. Navigate to the pd/extra directory on your system.
e. Paste the copy of helloworld.dll in the pd/extra directory
(right-click or Ctrl-V).
11. Test the external in pd.
a. the external should now be a useable object in pd.
b. open a new pd patch and try to create a helloworld object.
c. add a bang to the left inlet and test it out.
d. if the main pd console window displays "Hello world !!",
the external has succeeded.
Hope this helps!
-- middlepedal
Midi in on linux
@Gimmeapill said:
do you have the alsa module snd-seq loaded ?
lsmod|grep snd_seq
snd_seq_dummy 4996 2
snd_seq_oss 36480 5
snd_seq_midi 9984 2
snd_rawmidi 27264 3 snd_usb_lib,snd_mpu401_uart,snd_seq_midi
snd_seq_midi_event 8960 2 snd_seq_oss,snd_seq_midi
snd_seq 59120 6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer 25348 3 snd_rtctimer,snd_pcm,snd_seq
snd_seq_device 9868 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
snd 58372 16 snd_usb_audio,snd_hwdep,snd_mpu401,snd_mpu401_uart,snd_seq_oss,snd_intel8x0,snd_ac97_codec,snd_rawmidi,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq,snd_timer,snd_seq_device
Thanks, Gimmeapill, but it has been loaded all along and of course I am not getting midi.
Problem with sound / sound card
I hope anyone can help me out here.. I am by the way a newbie in PD, but have used Max/MSP for some time.
I have a couple of problems with PD when it comes to the sound part. I am running OSX on a G5, with a Digidesign digi002 rack as main sound card. The thing is, that i can´t get sound even when I run the "Test Audio and MIDI" patch from "Media", nor can I see anyhting happening in the boxes under "pd ------ audio-----"; it 0 all the way. This is with the digi002 soundcard. The same thing happens when I run the digi002 sound driver through JackOSX (so, the sound card i select in other words is Jack). On the other hand, MIDI in and out seems to work with digi002. Of course, I have also tried with the built-in sound card, and I have also tried with another sound card I got (M-Audio Ozone), and I get sound with both! Thanks a lot if anyone can give a hand on trying solving what´s wrong and how to fix it!
Also, I have another problem, when I open a new patcher, and want to create a sound object, it won´t let me write ~ ! I have tried to write the same, the same way in TextEdit, Max/MSP, and it works fine there, but not in PD. Also, it won´t let me copy and paste! If anyone knows anything about this issues, thanks!
Hanstein
Need help with PD externals
SUBJECT: Need help with PD externals
Hi,
-
I have written some code in C/C++. I would now like to create a pd external and be able to run my C/C++ code in pd (windows environment). I would like my PD object to have say 3-4 inlets and 2-3 outlets.
Furthermore at least one of the inlets would contain compound data, something like an array of 10-15 floats.
Thus my external would be a bit more complex than the 'very basic one', which has a single float as inlet, & a single float as outlet. -
I work in the windows environment (currently my operating environment has pentium machines with windows operating systems installed on them (windows XP, or windows 2000 Professional).
I am using a the free DevCPP or DevC++ compiler (version 4.9.9.2) the IDE, (which uses the gnu C compiler MinGW at its base). Furthermore, I am using: Pd version 0.38.4-extended-RC8 (windows platform). I wonder if someone has already developed externals in a same (or similar, i.e. Windows) environment.
- If someone has, can you please mail me a simple compilable code that you might have had prepared, and guide me through the exact steps which one must follow to make a pd external.
- I wish to know, if in the Windows/DevCPP compiler environment, whether it is possbile to create a PD external without creating a dll in windows, or is it always necessary to first create a dll, even in the simplest case?
- Last, but not the least, I must mention here that I don't have "a lot" of experience in pd, so I will appreciate if someone could explain things in an easy to understand style.
But in any case, I will ask again, in case I don't understand something.
I hope that should work.
Thanks and regards,
ps:
The following should actually have been posted as a separate thread, but since its related to the topic above, i continue to write it here:
In addition to what I have asked for above, I would also like some feedback on the following...
SUBJECT2: Creating/Compiling PD externals
My previous unsucessful attempts at creating/understanding the PD external:
I had tried to read through, and tried to implement the sample code in the tutorial, named:
"How to write an External for puredata" available at the iem site...
But I am facing a few problems, and here are some specific queries related to that:
A.) While in the windows environment, must one always need to create a dll first, or is it possible to create a PD external in any other way as well?
B.) If one must do it by first creating a dll, then the code as mentioned in the tutorial would need to be modified and can't just be copy+pasted & compiled directly. I.e.
One needs to paste the data declaration part in the header;
ii) Also one must declare all the subroutine (i.e. procedures/methods) names in the header file as well, while their definition or implementation goes in another main file, which must include our earlier created header file; and finally
iii) One must insert a special prefix before all the methods when are required for the dll...
Am I right about the 3 above mentioned points?
Thanks yet again,
Frozen reverb
"Frozen reverb" is a misnomer. It belongs in the Chindogu section along with real-time timestretching, inflatable dartboards, waterproof sponges and ashtrays for motorbikes. Why? Because reverb is by definition a time variant process, or a convolution of two signals one of which is the impulse response and one is the signal. Both change in time. What you kind of want is a spectral snapshot.
-
Claudes suggestion above, a large recirculating delay network running at 99.99999999% feedback.
Advantages: Sounds really good, its a real reverb with a complex evolution that's just very long.
Problems: It can go unstable and melt down the warp core. Claudes trick of zeroing teh feedback is foolproof, but it does require you to have an apropriate control level signal. Not good if you're feeding it from an audio only source.
Note: the final spectrum is the sum of all spectra the sound passes through, which might be a bit too heavy. The more sound you add to it, with a longer more changing sound, the closer it eventually gets to noise. -
A circular scanning window of the kind used in a timestretch algorithm
Advantages: It's indefinitely stable, and you can slowly wobble the window to get a "frozen but still moving" sound
Problems: Sounds crap because some periodicity from the windowing is always there.
Note: The Eventide has this in its infiniverb patch. The final spectrum is controllable, it's just some point in the input sound "frozen" by stopping the window from scanning forwards (usually when the input decays below a threshold). Take the B.14 Rockafella sampler and write your input to the table. Use an [env~]-[delta] pair to find when the
input starts to decay and then set the "precession percent" value to zero, the sound will freeze at that point. -
Resynthesised spectral snapshot
Advantages: Best technical solution, it sounds good and is indefinitely stable.
Problems: It's a monster that will eat your CPUs liver with some fava beans and a nice Chianti.
Note: 11.PianoReverb patch is included in the FFT examples. The description is something like "It punches in new partials when theres a peak that masks what's already there". You can only do this in the frequency domain. The final spectrum will be the maxima of the unique components in the last input sound that weren't in the previous sound. Just take the 11.PianoReverb patch in the FFT examples and turn the reverb time up to lots.