Difference between revisions of "Custom Samples"

From TidalCycles userbase
Jump to: navigation, search
(Marked this version for translation)
Line 1: Line 1:
 
<languages/>
 
<languages/>
 
<translate>
 
<translate>
 +
<!--T:1-->
 
Adding and using your own custom samples in TidalCycles is relatively easy. You don't actually add samples into TidalCycles, but instead add them into SuperCollider and the SuperDirt quark.  
 
Adding and using your own custom samples in TidalCycles is relatively easy. You don't actually add samples into TidalCycles, but instead add them into SuperCollider and the SuperDirt quark.  
 
To do this, you will need to customize your SuperDirt startup code.
 
To do this, you will need to customize your SuperDirt startup code.
  
= Custom SuperDirt Startup =
+
= Custom SuperDirt Startup = <!--T:2-->
  
 +
<!--T:3-->
 
When you open SuperCollider, instead of the normal <code>SuperDirt.start</code> code, you will need to write a longer script that tells SuperDirt where to find your samples. The startup script will look like this:
 
When you open SuperCollider, instead of the normal <code>SuperDirt.start</code> code, you will need to write a longer script that tells SuperDirt where to find your samples. The startup script will look like this:
  
 +
<!--T:4-->
 
<source lang="c">
 
<source lang="c">
 
(
 
(
Line 19: Line 22:
 
</source>
 
</source>
  
 +
<!--T:5-->
 
To run the above code, place the cursor anywhere inside that code block, then press <code>Ctrl+Enter</code> (or <code>Command+Enter</code> on MacOS) to evaluate the whole block.
 
To run the above code, place the cursor anywhere inside that code block, then press <code>Ctrl+Enter</code> (or <code>Command+Enter</code> on MacOS) to evaluate the whole block.
  
 +
<!--T:6-->
 
The above code will boot the SuperCollider server, then start up SuperDirt with some samples located at <code>/Users/myUserName/Dirt/samples</code>.  
 
The above code will boot the SuperCollider server, then start up SuperDirt with some samples located at <code>/Users/myUserName/Dirt/samples</code>.  
  
 +
<!--T:7-->
 
You can reference a longer example startup script located in the SuperDirt code repository: https://github.com/musikinformatik/SuperDirt/blob/develop/superdirt_startup.scd
 
You can reference a longer example startup script located in the SuperDirt code repository: https://github.com/musikinformatik/SuperDirt/blob/develop/superdirt_startup.scd
  
== Windows Paths ==
+
== Windows Paths == <!--T:8-->
  
 +
<!--T:9-->
 
If you are running Windows, you will need to escape the backslash characters in Windows paths:
 
If you are running Windows, you will need to escape the backslash characters in Windows paths:
  
 +
<!--T:10-->
 
<source>
 
<source>
 
~dirt.loadSoundFiles("c:\\Users\\myUserName\\Dirt\\samples\\*")
 
~dirt.loadSoundFiles("c:\\Users\\myUserName\\Dirt\\samples\\*")
 
</source>
 
</source>
  
= Sample Folder Structure =
+
= Sample Folder Structure = <!--T:11-->
  
 +
<!--T:12-->
 
In the above example, we have imported a folder at the path <code>/Users/myUserName/Dirt/samples</code>. In order for SuperDirt to recognize the sound names that Tidal sends, the
 
In the above example, we have imported a folder at the path <code>/Users/myUserName/Dirt/samples</code>. In order for SuperDirt to recognize the sound names that Tidal sends, the
 
<code>/Users/myUserName/Dirt/samples</code> folder will need to have sub-folders for each sound name, and each sound name folder will need to have sample files:
 
<code>/Users/myUserName/Dirt/samples</code> folder will need to have sub-folders for each sound name, and each sound name folder will need to have sample files:
  
  Users/
+
  <!--T:13-->
 +
Users/
 
  |-- myUserName/
 
  |-- myUserName/
 
     |-- Dirt/
 
     |-- Dirt/
Line 57: Line 67:
 
             |  |-- river.wav
 
             |  |-- river.wav
  
= Using the Custom Samples in Tidal Code =
+
= Using the Custom Samples in Tidal Code = <!--T:14-->
  
 +
<!--T:15-->
 
Given the folder structure above, you can now use the <code>myBass</code>, <code>hits</code>, and <code>field</code> sounds in your Tidal patterns:
 
Given the folder structure above, you can now use the <code>myBass</code>, <code>hits</code>, and <code>field</code> sounds in your Tidal patterns:
  
 +
<!--T:16-->
 
<source>
 
<source>
 
d1 $ s "mybass hits*4" # n (slow 2 $ run 3)
 
d1 $ s "mybass hits*4" # n (slow 2 $ run 3)
Line 66: Line 78:
 
</source>
 
</source>
  
= Specifying Multiple Folders =
+
= Specifying Multiple Folders = <!--T:17-->
  
 +
<!--T:18-->
 
If you have samples located in many folders, you can import them all:
 
If you have samples located in many folders, you can import them all:
  
 +
<!--T:19-->
 
<source lang="c">
 
<source lang="c">
 
(
 
(
Line 75: Line 89:
 
~dirt = SuperDirt(2, s); // two output channels
 
~dirt = SuperDirt(2, s); // two output channels
  
         // load samples from multiple folders:
+
         <!--T:20-->
 +
// load samples from multiple folders:
 
~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*");  
 
~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*");  
 
~dirt.loadSoundFiles("/Users/myUserName/sounds/*");  
 
~dirt.loadSoundFiles("/Users/myUserName/sounds/*");  
Line 81: Line 96:
 
~dirt.loadSoundFiles("/Users/myUserName/recordings/super-duper-experiments/*");  
 
~dirt.loadSoundFiles("/Users/myUserName/recordings/super-duper-experiments/*");  
  
s.sync; // wait for supercollider to finish booting up
+
<!--T:21-->
 +
s.sync; // wait for supercollider to finish booting up
 
~dirt.start(57120, [0, 0]); // start superdirt, listening on port 57120, create two orbits each sending audio to channel 0
 
~dirt.start(57120, [0, 0]); // start superdirt, listening on port 57120, create two orbits each sending audio to channel 0
 
};
 
};
Line 87: Line 103:
 
</source>
 
</source>
  
 +
<!--T:22-->
 
[[Category:Reference]]
 
[[Category:Reference]]
 
</translate>
 
</translate>

Revision as of 02:04, 15 December 2019

Other languages:
English • ‎español • ‎français

Adding and using your own custom samples in TidalCycles is relatively easy. You don't actually add samples into TidalCycles, but instead add them into SuperCollider and the SuperDirt quark. To do this, you will need to customize your SuperDirt startup code.

Custom SuperDirt Startup

When you open SuperCollider, instead of the normal SuperDirt.start code, you will need to write a longer script that tells SuperDirt where to find your samples. The startup script will look like this:

(
s.waitForBoot {
	~dirt = SuperDirt(2, s); // two output channels
	~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*"); // specify sample folder to load
	s.sync; // wait for supercollider to finish booting up
	~dirt.start(57120, [0, 0]); // start superdirt, listening on port 57120, create two orbits each sending audio to channel 0
};
);

To run the above code, place the cursor anywhere inside that code block, then press Ctrl+Enter (or Command+Enter on MacOS) to evaluate the whole block.

The above code will boot the SuperCollider server, then start up SuperDirt with some samples located at /Users/myUserName/Dirt/samples.

You can reference a longer example startup script located in the SuperDirt code repository: https://github.com/musikinformatik/SuperDirt/blob/develop/superdirt_startup.scd

Windows Paths

If you are running Windows, you will need to escape the backslash characters in Windows paths:

~dirt.loadSoundFiles("c:\\Users\\myUserName\\Dirt\\samples\\*")

Sample Folder Structure

In the above example, we have imported a folder at the path /Users/myUserName/Dirt/samples. In order for SuperDirt to recognize the sound names that Tidal sends, the /Users/myUserName/Dirt/samples folder will need to have sub-folders for each sound name, and each sound name folder will need to have sample files:

Users/
|-- myUserName/
    |-- Dirt/
        |-- samples/
            |-- myBass/
            |   |-- bass1.wav
            |   |-- bass2.wav
            |   |-- bass3.wav
            |-- hits/
            |   |-- hit1.wav
            |   |-- hit2.wav
            |   |-- hit3.wav
            |-- field/
            |   |-- bridge.wav
            |   |-- mountains1.wav
            |   |-- mountains2.wav
            |   |-- plains.wav
            |   |-- river.wav

Using the Custom Samples in Tidal Code

Given the folder structure above, you can now use the myBass, hits, and field sounds in your Tidal patterns:

d1 $ s "mybass hits*4" # n (slow 2 $ run 3)
d2 $ n "<0 2 1>" # s "field" # cut 1

Specifying Multiple Folders

If you have samples located in many folders, you can import them all:

(
s.waitForBoot {
	~dirt = SuperDirt(2, s); // two output channels

        // load samples from multiple folders:
	~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*"); 
	~dirt.loadSoundFiles("/Users/myUserName/sounds/*"); 
	~dirt.loadSoundFiles("/Users/myUserName/recordings/chaska-sessions/*");
	~dirt.loadSoundFiles("/Users/myUserName/recordings/super-duper-experiments/*"); 

	s.sync; // wait for supercollider to finish booting up
	~dirt.start(57120, [0, 0]); // start superdirt, listening on port 57120, create two orbits each sending audio to channel 0
};
);