首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在SuperCollider中,呈现声音文件的最佳方法是什么?

在SuperCollider中,呈现声音文件的最佳方法是什么?
EN

Stack Overflow用户
提问于 2011-07-18 19:06:19
回答 2查看 4.4K关注 0票数 2

以编程方式将SuperCollider程序呈现给文件(例如wav文件)的最佳方法是什么。

我可以指定文件的持续时间(例如30秒)吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-07-18 19:55:27

您可以使用Score.recordNRT来完成这个任务。

有一个关于如何使用这里的教程。

票数 4
EN

Stack Overflow用户

发布于 2014-05-23 00:27:41

除了Score.recordNRT之外,还有很多不同的方法可以做到这一点(这可能是比较方便的方法之一,也是我不知道的事情)。DiskOut.arpathchannelsArray作为args。您还可以尝试使用.record实例方法( Server )。下面是这两种方法的示例(来自帮助文档):

DiskOut.ar方式

代码语言:javascript
复制
// start something to record
x = Synth.new("bubbles");

// allocate a disk i/o buffer
b= Buffer.alloc(s, 65536, 2);

// create an output file for this buffer, leave it open
b.write("~/diskouttest.aiff".standardizePath, "aiff", "int16", 0, 0, true);
// create the diskout node; making sure it comes after the source
d = Synth.tail(nil, "help-Diskout", ["bufnum", b]);
// stop recording
d.free;
// stop the bubbles
x.free;
// close the buffer and the soundfile
b.close;
// free the buffer
b.free;

// play it back
(
x = Synth.basicNew("help-Diskin-2chan");
m = { arg buf; x.addToHeadMsg(nil, [\bufnum,buf])};

b = Buffer.cueSoundFile(s,"~/diskouttest.aiff".standardizePath, 0, 2, completionMessage: m);
)
x.free; b.close; b.free; // cleanup

Server.record方式:

代码语言:javascript
复制
s.boot; // start the server

// something to record
(
SynthDef("bubbles", {
    var f, zout;
    f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function
    zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave
    Out.ar(0, zout);
}).add;
SynthDef("tpulse", { arg out=0,freq=700,sawFreq=440.0;
    Out.ar(out, SyncSaw.ar(freq,  sawFreq,0.1) )
}).add;

)

x = Synth.new("bubbles");

s.prepareForRecord; // you have to call this first

s.record;

s.pauseRecording; // pausable

s.record // start again

s.stopRecording; // this closes the file and deallocates the buffer recording node, etc.

x.free; // stop the synths

// look in your recordings folder and you'll find a file named for this date and time    
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6737972

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档