jsyn icon indicating copy to clipboard operation
jsyn copied to clipboard

Minor issues with PlayGrains example

Open dhowe opened this issue 7 years ago • 1 comments

  1. There is a file/path required which appears to be on your local system, so the example crashes, until one either a) changes useSample to false, or b) provides a different sample:
	private static final boolean useSample = true;
	private final static boolean useRecorder = false;

	// File sampleFile = new File( "samples/instructions.wav" );
	File sampleFile = new File(
//			"/Users/phil/Work/jsyn/guitar100/Guitar100_Ocean_1#02.aif" );
			"/Users/phil/Music/samples/ChewyMonkeysWhistle.aiff" );

	/* Can be run as either an application or as an applet. */
	public static void main( String args[] )
	{
             ...
  1. lineOut.start() appears to be called twice below -- though doesn't cause any problem...
			synth.add( grainFarm );

			grainFarm.allocate( NUM_GRAINS );

			// Add an output so we can hear the grains.
			synth.add( lineOut = new LineOut() );

			grainFarm.getOutput().connect( 0, lineOut.input, 0 );
			grainFarm.getOutput().connect( 0, lineOut.input, 1 );

			// Start synthesizer using default stereo output at 44100 Hz.
			synth.start();
			// Start lineOut so it can pull data from other units.
			lineOut.start();

			if( useRecorder )
			{
				grainFarm.output.connect( 0, recorder.getInput(), 0 );
				// When we start the recorder it will pull data from the
				// oscillator
				// and sweeper.
				recorder.start();
			}

			setupGUI();
			// We only need to start the LineOut. It will pull data from the
			// oscillator.
			lineOut.start();

dhowe avatar Nov 22 '16 10:11 dhowe

Thanks. Maybe I should add some samples to the examples archive. But for now I just added an explanatory comment. Also I removed the extra lineOut.start().

philburk avatar Nov 24 '16 01:11 philburk