i_dropped_my_phone_the_screen_cracked

FLASH源码 2025-08-13

我放下手机屏幕破裂了

我放下手机屏幕是一个Web音频库,它使用方法链条和CSS风格的选择器来简化浏览器中的创建,配置和连接音频节点。这是Hello World:

 //create and connect sine and system out. start the sine
__ ( ) . sine ( ) . dac ( ) . play ( ) ;

还有一个更复杂的例子:

 //create and connect a sine oscillator (frequency of 180), lowpass,
//compressor and system output (level of .5).
__ ( ) . sine ( 180 ) . lowpass ( { frequency : 160 , q : 5 , id : "lp1" } ) . compressor ( ) . dac ( .5 ) ;

//select the sine using its type and change the detune to 10
__ ( "sine" ) . detune ( 10 ) ;

//use the id to get a reference to the lowpass
//filter and set the frequency to 600
__ ( "#lp1" ) . frequency ( 600 ) ;

//create and connect a sawtooth oscillator, waveshaper & compressor
//and connect the compressor to the existing dac we created above.
__ ( ) . saw ( 800 ) . waveshaper ( ) . compressor ( ) . connect ( "dac" ) ;

//change the ratio of both compressors to 12
__ ( "compressor" ) . attr ( "ratio" , 12 ) ;

//start the sine and the sawtooth
__ ( "sine,saw" ) . start ( ) ;

音频节点链可以使用宏封装为单元

 //define a simple macro named "microsynth"
__ ( ) . begin ( "microsynth" ) . sine ( ) . gain ( ) . end ( "microsynth" ) . dac ( ) ;

//change the frequency of the sine
__ ( "microsynth" ) . frequency ( 100 ) ;

//start it up
__ ( "microsynth" ) . start ( ) ;

宏可以包裹在简单的工厂功能中以创建插件,从而实例化实例,将它们连接到其他节点,单独或作为组,将它们嵌套在其他宏中,等等。

 //define a plugin called microsynth
cracked . microsynth = function ( params ) {
    //pass any params to begin() so they can associated with the instance
    __ ( ) . begin ( "microsynth" , params ) . sine ( ) . gain ( 0 ) . end ( "microsynth" ) ;
    //return cracked so we can chain methods
    return cracked ;
}

//create two instances with different ids
__ ( ) . microsynth ( { id : "micro1" } ) . lowpass ( ) . dac ( ) ;
__ ( ) . microsynth ( { id : "micro2" } ) . lowpass ( ) . connect ( "dac" ) ;

//change the frequency in the first
__ ( "#micro1" ) . frequency ( 1200 ) ;
//change the frequency in the second
__ ( "#micro2" ) . frequency ( 600 ) ;

//set the gain in both and start them
__ ( "microsynth" ) . volume ( 1 ) . start ( ) ;

通常,我放下手机的目标是简单,简洁而没有晦涩难懂,并使音频编码与修补模块化一样直观,因此噪音制造商可以专注于保持怪异和有趣。

如果您有兴趣了解更多信息,则有一个页面概述,完整的源文档,一个Reddit访谈,一些按压以及Mac或Linux有用的应用程序,可以尝试所有这些。

还有猫图片。

如果您想做出贡献,则可以向info@fastinversesquare.com发送评论,打开错误或功能增强功能或最重要的问题,请提交拉动请求。

下载源码

通过命令行克隆项目:

git clone https://github.com/billorcutt/i_dropped_my_phone_the_screen_cracked.git