├── .gitignore ├── LICENSE ├── README.md └── example-project ├── .vsconfig ├── Assets ├── AssetStoreTools.meta ├── AssetStoreTools │ ├── AS_Checklist.asset │ ├── AS_Checklist.asset.meta │ ├── Editor.meta │ └── Editor │ │ ├── AssetStoreTools.dll │ │ └── AssetStoreTools.dll.meta ├── SaveToMp3.meta └── SaveToMp3 │ ├── Encoder.meta │ ├── Encoder │ ├── EncodeMP3.cs │ ├── EncodeMP3.cs.meta │ ├── SavWav.cs │ ├── SavWav.cs.meta │ ├── WavToMp3.cs │ └── WavToMp3.cs.meta │ ├── Example.meta │ ├── Example │ ├── DemoScene.unity │ ├── DemoScene.unity.meta │ ├── ExampleScript.cs │ └── ExampleScript.cs.meta │ ├── Lame.meta │ ├── Lame │ ├── ExtendUtility.cs │ ├── ExtendUtility.cs.meta │ ├── LibMp3Lame.cs │ ├── LibMp3Lame.cs.meta │ ├── MP3FileWriter.cs │ ├── MP3FileWriter.cs.meta │ ├── NAudio.meta │ └── NAudio │ │ ├── AdpcmWaveFormat.cs │ │ ├── AdpcmWaveFormat.cs.meta │ │ ├── AudioMediaSubtypes.cs │ │ ├── AudioMediaSubtypes.cs.meta │ │ ├── Gsm610WaveFormat.cs │ │ ├── Gsm610WaveFormat.cs.meta │ │ ├── IWaveProvider.cs │ │ ├── IWaveProvider.cs.meta │ │ ├── RiffChunk.cs │ │ ├── RiffChunk.cs.meta │ │ ├── WaveFileReader.cs │ │ ├── WaveFileReader.cs.meta │ │ ├── WaveFormat.cs │ │ ├── WaveFormat.cs.meta │ │ ├── WaveFormatEncoding.cs │ │ ├── WaveFormatEncoding.cs.meta │ │ ├── WaveFormatExtensible.cs │ │ ├── WaveFormatExtensible.cs.meta │ │ ├── WaveFormatExtraData.cs │ │ ├── WaveFormatExtraData.cs.meta │ │ ├── WaveStream.cs │ │ └── WaveStream.cs.meta │ ├── Plugins.meta │ ├── Plugins │ ├── Android.meta │ ├── Android │ │ ├── libs.meta │ │ └── libs │ │ │ ├── arm64-v8a.meta │ │ │ ├── arm64-v8a │ │ │ ├── libmp3lame.so │ │ │ └── libmp3lame.so.meta │ │ │ ├── armeabi-v7a.meta │ │ │ ├── armeabi-v7a │ │ │ ├── libmp3lame.so │ │ │ └── libmp3lame.so.meta │ │ │ ├── x86.meta │ │ │ └── x86 │ │ │ ├── libmp3lame.so │ │ │ └── libmp3lame.so.meta │ ├── iOS.meta │ ├── iOS │ │ ├── libmp3lame.a │ │ └── libmp3lame.a.meta │ ├── lame.bundle.meta │ ├── lame.bundle │ │ ├── Contents.meta │ │ └── Contents │ │ │ ├── Headers.meta │ │ │ ├── Headers │ │ │ ├── lame.h │ │ │ └── lame.h.meta │ │ │ ├── Info.plist │ │ │ ├── Info.plist.meta │ │ │ ├── MacOS.meta │ │ │ ├── MacOS │ │ │ ├── lame │ │ │ └── lame.meta │ │ │ ├── Resources.meta │ │ │ ├── Resources │ │ │ ├── Info.plist │ │ │ └── Info.plist.meta │ │ │ ├── _CodeSignature.meta │ │ │ └── _CodeSignature │ │ │ ├── CodeResources │ │ │ └── CodeResources.meta │ ├── x86.meta │ ├── x86 │ │ ├── libmp3lame.dll │ │ └── libmp3lame.dll.meta │ ├── x86_64.meta │ └── x86_64 │ │ ├── libmp3lame.dll │ │ └── libmp3lame.dll.meta │ ├── Readme.txt │ └── Readme.txt.meta ├── Logs ├── AssetImportWorker0.log └── Packages-Update.log ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset └── UserSettings └── EditorUserSettings.asset /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | 21 | 22 | # Unity3D generated meta files 23 | *.pidb.meta 24 | 25 | # Unity3D Generated File On Crash Reports 26 | sysinfo.txt 27 | 28 | # Builds 29 | *.apk 30 | *.unitypackage 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Save audioClip to MP3 2 | 3 | 4 | **!WARNING!** 5 | **Probably, saving to mp3, broken for Unity 2020+. But all other stuff working** 6 | **FormatException: Not a WAVE file - no RIFF header** 7 | _Sorry, no time to look into that_ 8 | 9 | With this package you can save an audioclip to mp3 in unity3d. Also plugin can save audioclip to wav and convert wav to mp3. 10 | 11 | It works with *Windows, Android and IOS(tested)*. And probably on *Mac(untested, but should work)*. 12 | 13 | Lame unity port from https://github.com/3wz/Lame-For-Unity 14 | Wav save script from https://gist.github.com/darktable/2317063 15 | 16 | ### Convert audio clip to mp3 bytes array. For example to send it via network: 17 | ```C# 18 | public AudioClip clip; 19 | 20 | void Start(){ 21 | // Convert wav clip to mp3 bytes array 22 | //128 is recommend bitray for mp3 files 23 | byte[] mp3 = WavToMp3.ConvertWavToMp3(clip, 128); 24 | } 25 | ``` 26 | 27 | 28 | ### Save AudioClip at path with defined bitray as mp3 29 | ```C# 30 | // THIS METHOD PROBABLY BROKEN FOR UNITY 2020+ 31 | public AudioClip clip; 32 | 33 | void Start(){ 34 | // Save AudioClip at assets path with defined bitray as mp3 35 | //128 is recommend bitray for mp3 files 36 | EncodeMP3.SaveMp3(clip, $"{Application.dataPath}/mp3File", 128); 37 | } 38 | ``` 39 | 40 | ### Save AudioClip at path with as wav 41 | ```C# 42 | public AudioClip clip; 43 | 44 | void Start(){ 45 | // Save AudioClip at assets path as wav 46 | SavWav.SaveWav($"{Application.dataPath}/wavFile", clip); 47 | } 48 | ``` 49 | 50 | ## Installation 51 | ### From github 52 | 1. Download a source code zip this page 53 | 2. Extract it 54 | 3. Import it into the following directory in your Unity project 55 | - `Packages` (It works as an embedded package. For Unity 2018.1 or later) 56 | - `Assets` (Legacy way. For Unity 2017.1 or later) 57 | 58 | ### From Unity Asset Store 59 | 1. https://assetstore.unity.com/packages/tools/audio/save-audioclip-to-mp3-189071 60 | 2. Add it to project as usual 61 | -------------------------------------------------------------------------------- /example-project/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /example-project/Assets/AssetStoreTools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8466fccc5fcd4d74ea48c2a9411d446d 3 | folderAsset: yes 4 | timeCreated: 1588842340 5 | licenseType: Store 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /example-project/Assets/AssetStoreTools/AS_Checklist.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/AssetStoreTools/AS_Checklist.asset -------------------------------------------------------------------------------- /example-project/Assets/AssetStoreTools/AS_Checklist.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97a32309d33452b4e8bf5ee282ad9efd 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/AssetStoreTools/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf7638d43c18cec40b4b9312969b5378 3 | folderAsset: yes 4 | timeCreated: 1588842340 5 | licenseType: Store 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /example-project/Assets/AssetStoreTools/Editor/AssetStoreTools.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/AssetStoreTools/Editor/AssetStoreTools.dll -------------------------------------------------------------------------------- /example-project/Assets/AssetStoreTools/Editor/AssetStoreTools.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db89eddc1931309408191e6d4644d3c7 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 1 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51ba1f3d9cf8d9d45956c12d8b13c1fd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28e0b7445d6f7a84bbd1925617c6dbbb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder/EncodeMP3.cs: -------------------------------------------------------------------------------- 1 | /* GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | */ 9 | 10 | /*---------------------- BeatUp (C) 2016-------------------- */ 11 | 12 | 13 | using System; 14 | using System.IO; 15 | using System.Collections; 16 | using System.Threading; 17 | using UnityEngine; 18 | using NAudio.Lame; 19 | using NAudio.Wave.WZT; 20 | using NAudio.Wave; 21 | 22 | public static class EncodeMP3 { 23 | /// 24 | /// Save clip as mp3 25 | /// 26 | /// Unity AudioClip 27 | /// Path to save it 28 | /// Mp3 bitrate. Recommend to set it to 128 29 | public static void SaveMp3(AudioClip clip, string path, int bitRate) { 30 | if (!path.EndsWith(".mp3")) 31 | path = path + ".mp3"; 32 | 33 | ConvertAndWrite(clip, path, bitRate); 34 | } 35 | 36 | /// 37 | /// Save clip as wav 38 | /// 39 | /// Unity AudioClip 40 | /// Path to save it 41 | /// Mp3 bitrate. Recommend to set it to 128 42 | private static void ConvertAndWrite(AudioClip clip, string path, int bitRate) { 43 | var samples = new float[clip.samples * clip.channels]; 44 | 45 | clip.GetData(samples, 0); 46 | 47 | Int16[] intData = new Int16[samples.Length]; 48 | //converting in 2 float[] steps to Int16[], //then Int16[] to Byte[] 49 | 50 | Byte[] bytesData = new Byte[samples.Length * 2]; 51 | //bytesData array is twice the size of 52 | //dataSource array because a float converted in Int16 is 2 bytes. 53 | 54 | float rescaleFactor = 32767; //to convert float to Int16 55 | 56 | for (int i = 0; i < samples.Length; i++) { 57 | intData[i] = (short)(samples[i] * rescaleFactor); 58 | Byte[] byteArr = new Byte[2]; 59 | byteArr = BitConverter.GetBytes(intData[i]); 60 | byteArr.CopyTo(bytesData, i * 2); 61 | } 62 | 63 | File.WriteAllBytes(path, ConvertWavToMp3(bytesData, bitRate)); 64 | } 65 | 66 | /// 67 | /// Convert wav bytes to mp3 bytes 68 | /// derived from Gregorio Zanon's script 69 | /// 70 | /// Wav file readed as array 71 | /// Mp3 bitrate. Recommend to set it to 128 72 | /// 73 | private static byte[] ConvertWavToMp3(byte[] wavFile, int bitRate) { 74 | 75 | var retMs = new MemoryStream(); 76 | var ms = new MemoryStream(wavFile); 77 | var rdr = new WaveFileReader(ms); 78 | var wtr = new LameMP3FileWriter(retMs, rdr.WaveFormat, bitRate); 79 | 80 | rdr.CopyTo(wtr); 81 | return retMs.ToArray(); 82 | } 83 | } -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder/EncodeMP3.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5067b4ed11cff42459e750438059a60b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder/SavWav.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Calvin Rien 2 | // http://the.darktable.com 3 | // 4 | // This software is provided 'as-is', without any express or implied warranty. In 5 | // no event will the authors be held liable for any damages arising from the use 6 | // of this software. 7 | // 8 | // Permission is granted to anyone to use this software for any purpose, 9 | // including commercial applications, and to alter it and redistribute it freely, 10 | // subject to the following restrictions: 11 | // 12 | // 1. The origin of this software must not be misrepresented; you must not claim 13 | // that you wrote the original software. If you use this software in a product, 14 | // an acknowledgment in the product documentation would be appreciated but is not 15 | // required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not be 18 | // misrepresented as being the original software. 19 | // 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | // 22 | // ============================================================================= 23 | // 24 | // derived from Gregorio Zanon's script 25 | // http://forum.unity3d.com/threads/119295-Writing-AudioListener.GetOutputData-to-wav-problem?p=806734&viewfull=1#post806734 26 | 27 | using System; 28 | using System.IO; 29 | using UnityEngine; 30 | using System.Collections; 31 | using System.Collections.Generic; 32 | using System.Text; 33 | 34 | public static class SavWav { 35 | public const int HEADER_SIZE = 44; 36 | 37 | /// 38 | /// Save AudioClip as wav file 39 | /// 40 | /// Path to save that 41 | /// Unity AudioClip 42 | /// 43 | public static bool SaveWav(string filename, AudioClip clip) { 44 | if (!filename.ToLower().EndsWith(".wav")) { 45 | filename += ".wav"; 46 | } 47 | 48 | var filepath = Path.Combine(Application.persistentDataPath, filename); 49 | 50 | Debug.Log(filepath); 51 | 52 | // Make sure directory exists if user is saving to sub dir. 53 | Directory.CreateDirectory(Path.GetDirectoryName(filepath)); 54 | 55 | using (var fileStream = CreateEmpty(filepath)) { 56 | ConvertAndWrite(fileStream, clip); 57 | WriteHeader(fileStream, clip); 58 | } 59 | 60 | return true; // TODO: return false if there's a failure saving the file 61 | } 62 | 63 | /// 64 | /// Trim silence for audio 65 | /// 66 | /// Unity AudioClip 67 | /// Silence threshold 68 | /// On end trim event 69 | /// 70 | public static IEnumerator TrimSilence(AudioClip clip, float threshold, Action callback) { 71 | var samples = new float[clip.samples * clip.channels]; 72 | 73 | clip.GetData(samples, 0); 74 | 75 | yield return TrimSilence(new List(samples), threshold, clip.channels, clip.frequency, false, false, callback); 76 | } 77 | 78 | /// 79 | /// Trim silence for audio 80 | /// 81 | /// List of audio samples 82 | /// Silence threshold 83 | /// Channels. 1 - mono, 2 - stereo 84 | /// HZ. recommend is 44000 85 | /// is 3d sound? 86 | /// Is streaming sound? 87 | /// On end trim event> 88 | /// 89 | public static IEnumerator TrimSilence(List samples, float threshold, int channels, int hz, bool _3D, bool stream, Action callback) { 90 | int i; 91 | 92 | for (i = 0; i < samples.Count; i++) { 93 | if (i % 22050 == 0) 94 | yield return null; 95 | if (Mathf.Abs(samples[i]) > threshold) 96 | break; 97 | } 98 | yield return null; 99 | 100 | samples.RemoveRange(0, i); 101 | yield return null; 102 | 103 | for (i = samples.Count - 1; i > 0; i--) { 104 | if (i % 22050 == 0) 105 | yield return null; 106 | if (Mathf.Abs(samples[i]) > threshold) 107 | break; 108 | } 109 | yield return null; 110 | 111 | if (samples.Count != 0) 112 | samples.RemoveRange(i, samples.Count - i); 113 | yield return null; 114 | 115 | if (samples.Count == 0) 116 | samples.Add(0); 117 | 118 | AudioClip clip = AudioClip.Create("TempClip", samples.Count, channels, hz, _3D, stream); 119 | clip.SetData(samples.ToArray(), 0); 120 | yield return null; 121 | callback(clip); 122 | } 123 | 124 | /// 125 | /// Trim silence for audio 126 | /// 127 | /// Unity AudioClip 128 | /// Silence threshold 129 | /// On end trim event> 130 | /// 131 | public static IEnumerator TrimSilenceAll(AudioClip clip, float threshold, Action callback) { 132 | var samples = new float[clip.samples * clip.channels]; 133 | 134 | clip.GetData(samples, 0); 135 | yield return TrimSilenceAll(new List(samples), threshold, clip.channels, clip.frequency, false, false, callback); 136 | } 137 | 138 | /// 139 | /// Trim silence for audio 140 | /// 141 | /// List of audio samples 142 | /// Silence threshold 143 | /// Channels. 1 - mono, 2 - stereo 144 | /// HZ. recommend is 44000 145 | /// is 3d sound? 146 | /// Is streaming sound? 147 | /// On end trim event> 148 | /// 149 | public static IEnumerator TrimSilenceAll(List samples, float threshold, int channels, int hz, bool _3D, bool stream, Action callback) { 150 | List newSamples = new List(samples.Count); 151 | for (int i = 0; i < samples.Count; ++i) { 152 | if (i % 22050 == 0) 153 | yield return null; 154 | if (Mathf.Abs(samples[i]) > threshold) 155 | newSamples.Add(samples[i]); 156 | } 157 | 158 | yield return null; 159 | var clip = AudioClip.Create("TempClip", newSamples.Count, channels, hz, _3D, stream); 160 | 161 | clip.SetData(newSamples.ToArray(), 0); 162 | 163 | yield return null; 164 | callback(clip); 165 | } 166 | 167 | /// 168 | /// Write riff header 169 | /// 170 | public static void WriteHeader(MemoryStream stream, AudioClip clip) { 171 | var hz = clip.frequency; 172 | var channels = clip.channels; 173 | var samples = clip.samples; 174 | 175 | stream.Seek(0, SeekOrigin.Begin); 176 | 177 | Byte[] riff = System.Text.Encoding.UTF8.GetBytes("RIFF"); 178 | stream.Write(riff, 0, 4); 179 | 180 | Byte[] chunkSize = BitConverter.GetBytes(stream.Length - 8); 181 | stream.Write(chunkSize, 0, 4); 182 | 183 | Byte[] wave = System.Text.Encoding.ASCII.GetBytes("WAVE"); 184 | stream.Write(wave, 0, 4); 185 | 186 | Byte[] fmt = System.Text.Encoding.ASCII.GetBytes("fmt "); 187 | stream.Write(fmt, 0, 4); 188 | 189 | Byte[] subChunk1 = BitConverter.GetBytes(16); 190 | stream.Write(subChunk1, 0, 4); 191 | 192 | UInt16 two = 2; 193 | UInt16 one = 1; 194 | 195 | Byte[] audioFormat = BitConverter.GetBytes(one); 196 | stream.Write(audioFormat, 0, 2); 197 | 198 | Byte[] numChannels = BitConverter.GetBytes(channels); 199 | stream.Write(numChannels, 0, 2); 200 | 201 | Byte[] sampleRate = BitConverter.GetBytes(hz); 202 | stream.Write(sampleRate, 0, 4); 203 | 204 | Byte[] byteRate = BitConverter.GetBytes(hz * channels * 2); // sampleRate * bytesPerSample*number of channels, here 44100*2*2 205 | stream.Write(byteRate, 0, 4); 206 | 207 | UInt16 blockAlign = (ushort)(channels * 2); 208 | stream.Write(BitConverter.GetBytes(blockAlign), 0, 2); 209 | 210 | UInt16 bps = 16; 211 | Byte[] bitsPerSample = BitConverter.GetBytes(bps); 212 | stream.Write(bitsPerSample, 0, 2); 213 | 214 | Byte[] datastring = System.Text.Encoding.UTF8.GetBytes("data"); 215 | stream.Write(datastring, 0, 4); 216 | 217 | Byte[] subChunk2 = BitConverter.GetBytes(samples * channels * 2); 218 | stream.Write(subChunk2, 0, 4); 219 | 220 | stream.Seek(0, SeekOrigin.Begin); 221 | var bytes = new byte[] { (byte)stream.ReadByte(), (byte)stream.ReadByte(), (byte)stream.ReadByte(), (byte)stream.ReadByte() }; 222 | string s = Encoding.ASCII.GetString(bytes); 223 | Debug.Log(s); 224 | stream.Seek(0, SeekOrigin.Begin); 225 | } 226 | 227 | /// 228 | /// Create empty file 229 | /// 230 | /// Path 231 | /// 232 | static FileStream CreateEmpty(string filepath) { 233 | var fileStream = new FileStream(filepath, FileMode.Create); 234 | byte emptyByte = new byte(); 235 | 236 | for (int i = 0; i < HEADER_SIZE; i++) //preparing the header 237 | { 238 | fileStream.WriteByte(emptyByte); 239 | } 240 | 241 | return fileStream; 242 | } 243 | 244 | static void ConvertAndWrite(FileStream fileStream, AudioClip clip) { 245 | 246 | var samples = new float[clip.samples]; 247 | 248 | clip.GetData(samples, 0); 249 | 250 | Int16[] intData = new Int16[samples.Length]; 251 | //converting in 2 float[] steps to Int16[], //then Int16[] to Byte[] 252 | 253 | Byte[] bytesData = new Byte[samples.Length * 2]; 254 | //bytesData array is twice the size of 255 | //dataSource array because a float converted in Int16 is 2 bytes. 256 | 257 | float rescaleFactor = 32767; //to convert float to Int16 258 | 259 | for (int i = 0; i < samples.Length; i++) { 260 | intData[i] = (short)(samples[i] * rescaleFactor); 261 | Byte[] byteArr = new Byte[2]; 262 | byteArr = BitConverter.GetBytes(intData[i]); 263 | byteArr.CopyTo(bytesData, i * 2); 264 | } 265 | 266 | fileStream.Write(bytesData, 0, bytesData.Length); 267 | } 268 | 269 | static void WriteHeader(FileStream stream, AudioClip clip) { 270 | var hz = clip.frequency; 271 | var channels = clip.channels; 272 | var samples = clip.samples; 273 | 274 | stream.Seek(0, SeekOrigin.Begin); 275 | 276 | Byte[] riff = System.Text.Encoding.UTF8.GetBytes("RIFF"); 277 | stream.Write(riff, 0, 4); 278 | 279 | Byte[] chunkSize = BitConverter.GetBytes(stream.Length - 8); 280 | stream.Write(chunkSize, 0, 4); 281 | 282 | Byte[] wave = System.Text.Encoding.ASCII.GetBytes("WAVE"); 283 | stream.Write(wave, 0, 4); 284 | 285 | Byte[] fmt = System.Text.Encoding.ASCII.GetBytes("fmt "); 286 | stream.Write(fmt, 0, 4); 287 | 288 | Byte[] subChunk1 = BitConverter.GetBytes(16); 289 | stream.Write(subChunk1, 0, 4); 290 | 291 | UInt16 two = 2; 292 | UInt16 one = 1; 293 | 294 | Byte[] audioFormat = BitConverter.GetBytes(one); 295 | stream.Write(audioFormat, 0, 2); 296 | 297 | Byte[] numChannels = BitConverter.GetBytes(channels); 298 | stream.Write(numChannels, 0, 2); 299 | 300 | Byte[] sampleRate = BitConverter.GetBytes(hz); 301 | stream.Write(sampleRate, 0, 4); 302 | 303 | Byte[] byteRate = BitConverter.GetBytes(hz * channels * 2); // sampleRate * bytesPerSample*number of channels, here 44100*2*2 304 | stream.Write(byteRate, 0, 4); 305 | 306 | UInt16 blockAlign = (ushort)(channels * 2); 307 | stream.Write(BitConverter.GetBytes(blockAlign), 0, 2); 308 | 309 | UInt16 bps = 16; 310 | Byte[] bitsPerSample = BitConverter.GetBytes(bps); 311 | stream.Write(bitsPerSample, 0, 2); 312 | 313 | Byte[] datastring = System.Text.Encoding.UTF8.GetBytes("data"); 314 | stream.Write(datastring, 0, 4); 315 | 316 | Byte[] subChunk2 = BitConverter.GetBytes(samples * channels * 2); 317 | stream.Write(subChunk2, 0, 4); 318 | 319 | stream.Seek(0, SeekOrigin.Begin); 320 | var bytes = new byte[] { (byte)stream.ReadByte(), (byte)stream.ReadByte(), (byte)stream.ReadByte(), (byte)stream.ReadByte() }; 321 | string s = Encoding.ASCII.GetString(bytes); 322 | Debug.Log(s); 323 | stream.Seek(0, SeekOrigin.Begin); 324 | } 325 | } -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder/SavWav.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a4a731eaf00d0149bf9f6900aa4ad39 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder/WavToMp3.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections; 4 | using System.Threading; 5 | using UnityEngine; 6 | using NAudio.Lame; 7 | using NAudio.Wave.WZT; 8 | using NAudio.Wave; 9 | 10 | 11 | public static class WavToMp3 { 12 | /// 13 | /// Convert Wav to MP3 to send it via network or save it to file 14 | /// 15 | /// Unity AudioClip 16 | /// Mp3 bitrate. Recommend to set it to 128 17 | /// 18 | public static byte[] ConvertWavToMp3(AudioClip clip, int bitRate) { 19 | var samples = new float[clip.samples * clip.channels]; 20 | 21 | clip.GetData(samples, 0); 22 | 23 | Int16[] intData = new Int16[samples.Length]; 24 | //converting in 2 float[] steps to Int16[], //then Int16[] to Byte[] 25 | 26 | Byte[] bytesData = new Byte[samples.Length * 2]; 27 | //bytesData array is twice the size of 28 | //dataSource array because a float converted in Int16 is 2 bytes. 29 | 30 | float rescaleFactor = 32767; //to convert float to Int16 31 | 32 | for (int i = 0; i < samples.Length; i++) { 33 | intData[i] = (short)(samples[i] * rescaleFactor); 34 | Byte[] byteArr = new Byte[2]; 35 | byteArr = BitConverter.GetBytes(intData[i]); 36 | byteArr.CopyTo(bytesData, i * 2); 37 | } 38 | 39 | var retMs = new MemoryStream(); 40 | var ms = new MemoryStream(SavWav.HEADER_SIZE + bytesData.Length); 41 | for (int i = 0; i < SavWav.HEADER_SIZE; i++) 42 | ms.WriteByte(new byte()); 43 | ms.Write(bytesData, 0, bytesData.Length); 44 | SavWav.WriteHeader(ms, clip); 45 | 46 | var rdr = new WaveFileReader(ms); 47 | var wtr = new LameMP3FileWriter(retMs, rdr.WaveFormat, bitRate); 48 | rdr.CopyTo(wtr); 49 | 50 | return retMs.ToArray(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Encoder/WavToMp3.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bc1aa53ea1d574459f3dbb4eedc5345 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 421f5f545e4ec2c48b33d92fbc8f1059 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Example/DemoScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Example/DemoScene.unity -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Example/DemoScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d16458cc7636dd4d846a6dee58e6da6 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Example/ExampleScript.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ExampleScript : MonoBehaviour { 6 | [SerializeField] AudioClip clip; 7 | 8 | void Start() { 9 | ConvertToArray(); 10 | SaveAsMP3(); 11 | SaveAsWav(); 12 | 13 | } 14 | 15 | void ConvertToArray() { 16 | // Convert clip to mp3 bytes array 17 | //128 is recommend bitray for mp3 files 18 | byte[] mp3 = WavToMp3.ConvertWavToMp3(clip, 128); 19 | Debug.Log($"Convert to array {mp3.Length}"); ; 20 | } 21 | 22 | void SaveAsMP3() { 23 | // Save AudioClip at assets path with defined bitray as mp3 24 | //128 is recommend bitray for mp3 files 25 | EncodeMP3.SaveMp3(clip, $"{Application.dataPath}/mp3File", 128); 26 | Debug.Log($"Save file to {$"{Application.dataPath}/*"}"); ; 27 | } 28 | 29 | void SaveAsWav() { 30 | // Save AudioClip at assets path as wav 31 | SavWav.SaveWav($"{Application.dataPath}/wavFile", clip); 32 | Debug.Log($"Save file to {$"{Application.dataPath}/*"}"); ; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Example/ExampleScript.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a625143d82bde344b2d405499c6bbc8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a580f1e121a94f4babb0542c2345e60 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/ExtendUtility.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | public static class ExtendUtility 4 | { 5 | // Only useful before .NET 4 6 | public static void CopyTo(this Stream input, Stream output) 7 | { 8 | byte[] buffer = new byte[16 * 1024]; // Fairly arbitrary size 9 | int bytesRead; 10 | 11 | while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) 12 | { 13 | output.Write(buffer, 0, bytesRead); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/ExtendUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb12997fe1438df428b9bca708076dea 3 | timeCreated: 1493119352 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/LibMp3Lame.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d66ded0e78d16b9488dfb0e9247211e7 3 | timeCreated: 1493208137 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/MP3FileWriter.cs: -------------------------------------------------------------------------------- 1 | #region MIT license 2 | // 3 | // MIT license 4 | // 5 | // Copyright (c) 2013 Corey Murtagh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | #endregion 26 | using System; 27 | using System.IO; 28 | using System.Runtime.InteropServices; 29 | using NAudio.Lame.DLL; 30 | using NAudio.Wave.WZT; 31 | 32 | namespace NAudio.Lame 33 | { 34 | /// MP3 encoding class, uses libmp3lame DLL to encode. 35 | public class LameMP3FileWriter : Stream 36 | { 37 | /// Union class for fast buffer conversion 38 | /// 39 | /// 40 | /// Because of the way arrays work in .NET, all of the arrays will have the same 41 | /// length value. To prevent unaware code from trying to read/write from out of 42 | /// bounds, allocation is done at the grain of the Least Common Multiple of the 43 | /// sizes of the contained types. In this case the LCM is 8 bytes - the size of 44 | /// a double or a long - which simplifies allocation. 45 | /// 46 | /// This means that when you ask for an array of 500 bytes you will actually get 47 | /// an array of 63 doubles - 504 bytes total. Any code that uses the length of 48 | /// the array will see only 63 bytes, shorts, etc. 49 | /// 50 | /// CodeAnalysis does not like this class, with good reason. It should never be 51 | /// exposed beyond the scope of the MP3FileWriter. 52 | /// 53 | /// 54 | // uncomment to suppress CodeAnalysis warnings for the ArrayUnion class: 55 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1900:ValueTypeFieldsShouldBePortable", Justification = "This design breaks portability, but is never exposed outside the class. Tested on 32-bit and 64-bit.")] 56 | [StructLayout(LayoutKind.Explicit)] 57 | private class ArrayUnion 58 | { 59 | /// Size array in bytes 60 | [FieldOffset(0)] 61 | public readonly int nBytes; 62 | 63 | [FieldOffset(16)] 64 | public readonly byte[] bytes; 65 | 66 | [FieldOffset(16)] 67 | public readonly short[] shorts; 68 | 69 | [FieldOffset(16)] 70 | public readonly int[] ints; 71 | 72 | [FieldOffset(16)] 73 | public readonly long[] longs; 74 | 75 | [FieldOffset(16)] 76 | public readonly float[] floats; 77 | 78 | [FieldOffset(16)] 79 | public readonly double[] doubles; 80 | 81 | // True sizes of the various array types, calculated from number of bytes 82 | 83 | public int nShorts { get { return nBytes / 2; } } 84 | public int nInts { get { return nBytes / 4; } } 85 | public int nLongs { get { return nBytes / 8; } } 86 | public int nFloats { get { return nBytes / 4; } } 87 | public int nDoubles { get { return nBytes / 8; } } 88 | 89 | /// Initialize array to hold the requested number of bytes 90 | /// Minimum byte count of array 91 | /// 92 | /// Since all arrays will have the same apparent count, allocation 93 | /// is done on the array with the largest data type. This helps 94 | /// to prevent out-of-bounds reads and writes by methods that do 95 | /// not know about the union. 96 | /// 97 | public ArrayUnion(int reqBytes) 98 | { 99 | // Calculate smallest number of doubles required to store the 100 | // requested byte count 101 | int reqDoubles = (reqBytes + 7) / 8; 102 | 103 | this.doubles = new double[reqDoubles]; 104 | this.nBytes = reqDoubles * 8; 105 | } 106 | }; 107 | 108 | #region Properties 109 | // LAME library context 110 | private LibMp3Lame _lame; 111 | 112 | // Format of input wave data 113 | private readonly WaveFormat inputFormat; 114 | 115 | // Output stream to write encoded data to 116 | private Stream outStream; 117 | 118 | // Flag to control whether we should dispose of output stream 119 | private bool disposeOutput = false; 120 | #endregion 121 | 122 | #region Structors 123 | /// Create MP3FileWriter to write to a file on disk 124 | /// Name of file to create 125 | /// Input WaveFormat 126 | /// LAME quality preset 127 | public LameMP3FileWriter(string outFileName, WaveFormat format, LAMEPreset quality) 128 | : this(File.Create(outFileName), format, quality) 129 | { 130 | this.disposeOutput = true; 131 | } 132 | 133 | /// Create MP3FileWriter to write to supplied stream 134 | /// Stream to write encoded data to 135 | /// Input WaveFormat 136 | /// LAME quality preset 137 | public LameMP3FileWriter(Stream outStream, WaveFormat format, LAMEPreset quality) 138 | : base() 139 | { 140 | // sanity check 141 | if (outStream == null) 142 | throw new ArgumentNullException("outStream"); 143 | if (format == null) 144 | throw new ArgumentNullException("format"); 145 | 146 | // check for unsupported wave formats 147 | if (format.Channels != 1 && format.Channels != 2) 148 | throw new ArgumentException(string.Format("Unsupported number of channels {0}", format.Channels), "format"); 149 | if (format.Encoding != WaveFormatEncoding.Pcm && format.Encoding != WaveFormatEncoding.IeeeFloat) 150 | throw new ArgumentException(string.Format("Unsupported encoding format {0}", format.Encoding.ToString()), "format"); 151 | if (format.Encoding == WaveFormatEncoding.Pcm && format.BitsPerSample != 16) 152 | throw new ArgumentException(string.Format("Unsupported PCM sample size {0}", format.BitsPerSample), "format"); 153 | if (format.Encoding == WaveFormatEncoding.IeeeFloat && format.BitsPerSample != 32) 154 | throw new ArgumentException(string.Format("Unsupported Float sample size {0}", format.BitsPerSample), "format"); 155 | if (format.SampleRate < 8000 || format.SampleRate > 48000) 156 | throw new ArgumentException(string.Format("Unsupported Sample Rate {0}", format.SampleRate), "format"); 157 | 158 | // select encoder function that matches data format 159 | if (format.Encoding == WaveFormatEncoding.Pcm) 160 | { 161 | if (format.Channels == 1) 162 | _encode = encode_pcm_16_mono; 163 | else 164 | _encode = encode_pcm_16_stereo; 165 | } 166 | else 167 | { 168 | if (format.Channels == 1) 169 | _encode = encode_float_mono; 170 | else 171 | _encode = encode_float_stereo; 172 | } 173 | 174 | // Set base properties 175 | this.inputFormat = format; 176 | this.outStream = outStream; 177 | this.disposeOutput = false; 178 | 179 | // Allocate buffers based on sample rate 180 | this.inBuffer = new ArrayUnion(format.AverageBytesPerSecond); 181 | this.outBuffer = new byte[format.SampleRate * 5 / 4 + 7200]; 182 | 183 | // Initialize lame library 184 | this._lame = new LibMp3Lame(); 185 | 186 | this._lame.InputSampleRate = format.SampleRate; 187 | this._lame.NumChannels = format.Channels; 188 | 189 | this._lame.SetPreset(quality); 190 | 191 | this._lame.InitParams(); 192 | } 193 | 194 | 195 | /// Create MP3FileWriter to write to a file on disk 196 | /// Name of file to create 197 | /// Input WaveFormat 198 | /// Output bit rate in kbps 199 | public LameMP3FileWriter(string outFileName, WaveFormat format, int bitRate) 200 | : this(File.Create(outFileName), format, bitRate) 201 | { 202 | this.disposeOutput = true; 203 | } 204 | 205 | /// Create MP3FileWriter to write to supplied stream 206 | /// Stream to write encoded data to 207 | /// Input WaveFormat 208 | /// Output bit rate in kbps 209 | public LameMP3FileWriter(Stream outStream, WaveFormat format, int bitRate) 210 | : base() 211 | { 212 | // sanity check 213 | if (outStream == null) 214 | throw new ArgumentNullException("outStream"); 215 | if (format == null) 216 | throw new ArgumentNullException("format"); 217 | 218 | // check for unsupported wave formats 219 | if (format.Channels != 1 && format.Channels != 2) 220 | throw new ArgumentException(string.Format("Unsupported number of channels {0}", format.Channels), "format"); 221 | if (format.Encoding != WaveFormatEncoding.Pcm && format.Encoding != WaveFormatEncoding.IeeeFloat) 222 | throw new ArgumentException(string.Format("Unsupported encoding format {0}", format.Encoding.ToString()), "format"); 223 | if (format.Encoding == WaveFormatEncoding.Pcm && format.BitsPerSample != 16) 224 | throw new ArgumentException(string.Format("Unsupported PCM sample size {0}", format.BitsPerSample), "format"); 225 | if (format.Encoding == WaveFormatEncoding.IeeeFloat && format.BitsPerSample != 32) 226 | throw new ArgumentException(string.Format("Unsupported Float sample size {0}", format.BitsPerSample), "format"); 227 | if (format.SampleRate < 8000 || format.SampleRate > 48000) 228 | throw new ArgumentException(string.Format("Unsupported Sample Rate {0}", format.SampleRate), "format"); 229 | 230 | // select encoder function that matches data format 231 | if (format.Encoding == WaveFormatEncoding.Pcm) 232 | { 233 | if (format.Channels == 1) 234 | _encode = encode_pcm_16_mono; 235 | else 236 | _encode = encode_pcm_16_stereo; 237 | } 238 | else 239 | { 240 | if (format.Channels == 1) 241 | _encode = encode_float_mono; 242 | else 243 | _encode = encode_float_stereo; 244 | } 245 | 246 | // Set base properties 247 | this.inputFormat = format; 248 | this.outStream = outStream; 249 | this.disposeOutput = false; 250 | 251 | // Allocate buffers based on sample rate 252 | this.inBuffer = new ArrayUnion(format.AverageBytesPerSecond); 253 | this.outBuffer = new byte[format.SampleRate * 5 / 4 + 7200]; 254 | 255 | // Initialize lame library 256 | this._lame = new LibMp3Lame(); 257 | 258 | this._lame.InputSampleRate = format.SampleRate; 259 | this._lame.NumChannels = format.Channels; 260 | 261 | this._lame.BitRate = bitRate; 262 | 263 | this._lame.InitParams(); 264 | } 265 | 266 | 267 | // Close LAME instance and output stream on dispose 268 | /// Dispose of object 269 | /// True if called from destructor, false otherwise 270 | protected override void Dispose(bool final) 271 | { 272 | if (_lame != null && outStream != null) 273 | Flush(); 274 | 275 | if (_lame != null) 276 | { 277 | _lame.Dispose(); 278 | _lame = null; 279 | } 280 | 281 | if (outStream != null && disposeOutput) 282 | { 283 | outStream.Dispose(); 284 | outStream = null; 285 | } 286 | 287 | base.Dispose(final); 288 | } 289 | #endregion 290 | 291 | /// Get internal LAME library instance 292 | /// LAME library instance 293 | public LibMp3Lame GetLameInstance() 294 | { 295 | return _lame; 296 | } 297 | 298 | #region Internal encoder operations 299 | // Input buffer 300 | private ArrayUnion inBuffer = null; 301 | 302 | /// Current write position in input buffer 303 | private int inPosition; 304 | 305 | /// Output buffer, size determined by call to Lame.beInitStream 306 | protected byte[] outBuffer; 307 | 308 | long InputByteCount = 0; 309 | long OutputByteCount = 0; 310 | 311 | // encoder write functions, one for each supported input wave format 312 | 313 | private int encode_pcm_16_mono() 314 | { 315 | return _lame.Write(inBuffer.shorts, inPosition / 2, outBuffer, outBuffer.Length, true); 316 | } 317 | 318 | private int encode_pcm_16_stereo() 319 | { 320 | return _lame.Write(inBuffer.shorts, inPosition / 2, outBuffer, outBuffer.Length, false); 321 | } 322 | 323 | private int encode_float_mono() 324 | { 325 | return _lame.Write(inBuffer.floats, inPosition / 4, outBuffer, outBuffer.Length, true); 326 | } 327 | 328 | private int encode_float_stereo() 329 | { 330 | return _lame.Write(inBuffer.floats, inPosition / 4, outBuffer, outBuffer.Length, false); 331 | } 332 | 333 | // Selected encoding write function 334 | delegate int delEncode(); 335 | delEncode _encode = null; 336 | 337 | // Pass data to encoder 338 | private void Encode() 339 | { 340 | // check if encoder closed 341 | if (outStream == null || _lame == null) 342 | throw new InvalidOperationException("Output Stream closed."); 343 | 344 | // If no data to encode, do nothing 345 | if (inPosition < inputFormat.Channels * 2) 346 | return; 347 | 348 | // send to encoder 349 | int rc = _encode(); 350 | 351 | if (rc > 0) 352 | { 353 | outStream.Write(outBuffer, 0, rc); 354 | OutputByteCount += rc; 355 | } 356 | 357 | InputByteCount += inPosition; 358 | inPosition = 0; 359 | } 360 | #endregion 361 | 362 | #region Stream implementation 363 | /// Write-only stream. Always false. 364 | public override bool CanRead { get { return false; } } 365 | /// Non-seekable stream. Always false. 366 | public override bool CanSeek { get { return false; } } 367 | /// True when encoder can accept more data 368 | public override bool CanWrite { get { return outStream != null && _lame != null; } } 369 | 370 | /// Dummy Position. Always 0. 371 | public override long Position 372 | { 373 | get { return 0; } 374 | set { throw new NotImplementedException(); } 375 | } 376 | 377 | /// Dummy Length. Always 0. 378 | public override long Length 379 | { 380 | get { return 0; } 381 | } 382 | 383 | /// Add data to output buffer, sending to encoder when buffer full 384 | /// Source buffer 385 | /// Offset of data in buffer 386 | /// Length of data 387 | public override void Write(byte[] buffer, int offset, int count) 388 | { 389 | while (count > 0) 390 | { 391 | int blockSize = Math.Min(inBuffer.nBytes - inPosition, count); 392 | Buffer.BlockCopy(buffer, offset, inBuffer.bytes, inPosition, blockSize); 393 | 394 | inPosition += blockSize; 395 | count -= blockSize; 396 | offset += blockSize; 397 | 398 | if (inPosition >= inBuffer.nBytes) 399 | Encode(); 400 | } 401 | } 402 | 403 | /// Finalise compression, add final output to output stream and close encoder 404 | public override void Flush() 405 | { 406 | // write remaining data 407 | if (inPosition > 0) 408 | Encode(); 409 | 410 | // finalize compression 411 | int rc = _lame.Flush(outBuffer, outBuffer.Length); 412 | if (rc > 0) 413 | outStream.Write(outBuffer, 0, rc); 414 | 415 | // Cannot continue after flush, so clear output stream 416 | if (disposeOutput) 417 | outStream.Dispose(); 418 | outStream = null; 419 | } 420 | 421 | /// Reading not supported. Throws NotImplementedException. 422 | /// 423 | /// 424 | /// 425 | /// 426 | public override int Read(byte[] buffer, int offset, int count) 427 | { 428 | throw new NotImplementedException(); 429 | } 430 | 431 | /// Setting length not supported. Throws NotImplementedException. 432 | /// Length value 433 | public override void SetLength(long value) 434 | { 435 | throw new NotImplementedException(); 436 | } 437 | 438 | /// Seeking not supported. Throws NotImplementedException. 439 | /// Seek offset 440 | /// Seek origin 441 | public override long Seek(long offset, SeekOrigin origin) 442 | { 443 | throw new NotImplementedException(); 444 | } 445 | #endregion 446 | } 447 | } 448 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/MP3FileWriter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb5c882d3dd15214491ac8aaf1f5b608 3 | timeCreated: 1493208137 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23b199320e3e7df47a5ebee61346c2b0 3 | folderAsset: yes 4 | timeCreated: 1493208131 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/AdpcmWaveFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace NAudio.Wave.WZT 7 | { 8 | /// 9 | /// Microsoft ADPCM 10 | /// See http://icculus.org/SDL_sound/downloads/external_documentation/wavecomp.htm 11 | /// 12 | [StructLayout(LayoutKind.Sequential, Pack=2)] 13 | public class AdpcmWaveFormat : WaveFormat 14 | { 15 | short samplesPerBlock; 16 | short numCoeff; 17 | // 7 pairs of coefficients 18 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] 19 | short[] coefficients; 20 | 21 | /// 22 | /// Empty constructor needed for marshalling from a pointer 23 | /// 24 | AdpcmWaveFormat() : this(8000,1) 25 | { 26 | } 27 | 28 | /// 29 | /// Samples per block 30 | /// 31 | public int SamplesPerBlock 32 | { 33 | get { return samplesPerBlock; } 34 | } 35 | 36 | /// 37 | /// Number of coefficients 38 | /// 39 | public int NumCoefficients 40 | { 41 | get { return numCoeff; } 42 | } 43 | 44 | /// 45 | /// Coefficients 46 | /// 47 | public short[] Coefficients 48 | { 49 | get { return coefficients; } 50 | } 51 | 52 | /// 53 | /// Microsoft ADPCM 54 | /// 55 | /// Sample Rate 56 | /// Channels 57 | public AdpcmWaveFormat(int sampleRate, int channels) : 58 | base(sampleRate,0,channels) 59 | { 60 | this.waveFormatTag = WaveFormatEncoding.Adpcm; 61 | 62 | // TODO: validate sampleRate, bitsPerSample 63 | this.extraSize = 32; 64 | switch(this.sampleRate) 65 | { 66 | case 8000: 67 | case 11025: 68 | blockAlign = 256; 69 | break; 70 | case 22050: 71 | blockAlign = 512; 72 | break; 73 | case 44100: 74 | default: 75 | blockAlign = 1024; 76 | break; 77 | } 78 | 79 | this.bitsPerSample = 4; 80 | this.samplesPerBlock = (short) ((((blockAlign - (7 * channels)) * 8) / (bitsPerSample * channels)) + 2); 81 | this.averageBytesPerSecond = 82 | ((this.SampleRate * blockAlign) / samplesPerBlock); 83 | 84 | // samplesPerBlock = blockAlign - (7 * channels)) * (2 / channels) + 2; 85 | 86 | 87 | numCoeff = 7; 88 | coefficients = new short[14] { 89 | 256,0,512,-256,0,0,192,64,240,0,460,-208,392,-232 90 | }; 91 | } 92 | 93 | /// 94 | /// Serializes this wave format 95 | /// 96 | /// Binary writer 97 | public override void Serialize(System.IO.BinaryWriter writer) 98 | { 99 | base.Serialize(writer); 100 | writer.Write(samplesPerBlock); 101 | writer.Write(numCoeff); 102 | foreach (short coefficient in coefficients) 103 | { 104 | writer.Write(coefficient); 105 | } 106 | } 107 | 108 | /// 109 | /// String Description of this WaveFormat 110 | /// 111 | public override string ToString() 112 | { 113 | return String.Format("Microsoft ADPCM {0} Hz {1} channels {2} bits per sample {3} samples per block", 114 | this.SampleRate, this.channels, this.bitsPerSample, this.samplesPerBlock); 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/AdpcmWaveFormat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60f6eb670e8f81f4382cc6d1e8ac13fa 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/AudioMediaSubtypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace NAudio.Dmo.WZT 6 | { 7 | class AudioMediaSubtypes 8 | { 9 | public static readonly Guid MEDIASUBTYPE_PCM = new Guid("00000001-0000-0010-8000-00AA00389B71"); // PCM audio. 10 | public static readonly Guid MEDIASUBTYPE_PCMAudioObsolete = new Guid("e436eb8a-524f-11ce-9f53-0020af0ba770"); // Obsolete. Do not use. 11 | public static readonly Guid MEDIASUBTYPE_MPEG1Packet = new Guid("e436eb80-524f-11ce-9f53-0020af0ba770"); // MPEG1 Audio packet. 12 | public static readonly Guid MEDIASUBTYPE_MPEG1Payload = new Guid("e436eb81-524f-11ce-9f53-0020af0ba770"); // MPEG1 Audio Payload. 13 | public static readonly Guid MEDIASUBTYPE_MPEG2_AUDIO = new Guid("e06d802b-db46-11cf-b4d1-00805f6cbbea"); // MPEG-2 audio data 14 | public static readonly Guid MEDIASUBTYPE_DVD_LPCM_AUDIO = new Guid("e06d8032-db46-11cf-b4d1-00805f6cbbea"); // DVD audio data 15 | public static readonly Guid MEDIASUBTYPE_DRM_Audio = new Guid("00000009-0000-0010-8000-00aa00389b71"); // Corresponds to WAVE_FORMAT_DRM. 16 | public static readonly Guid MEDIASUBTYPE_IEEE_FLOAT = new Guid("00000003-0000-0010-8000-00aa00389b71"); // Corresponds to WAVE_FORMAT_IEEE_FLOAT 17 | public static readonly Guid MEDIASUBTYPE_DOLBY_AC3 = new Guid("e06d802c-db46-11cf-b4d1-00805f6cbbea"); // Dolby data 18 | public static readonly Guid MEDIASUBTYPE_DOLBY_AC3_SPDIF = new Guid("00000092-0000-0010-8000-00aa00389b71"); // Dolby AC3 over SPDIF. 19 | public static readonly Guid MEDIASUBTYPE_RAW_SPORT = new Guid("00000240-0000-0010-8000-00aa00389b71"); // Equivalent to MEDIASUBTYPE_DOLBY_AC3_SPDIF. 20 | public static readonly Guid MEDIASUBTYPE_SPDIF_TAG_241h = new Guid("00000241-0000-0010-8000-00aa00389b71"); // Equivalent to MEDIASUBTYPE_DOLBY_AC3_SPDIF. 21 | //http://msdn.microsoft.com/en-us/library/dd757532%28VS.85%29.aspx 22 | public static readonly Guid WMMEDIASUBTYPE_MP3 = new Guid("00000055-0000-0010-8000-00AA00389B71"); 23 | // others? 24 | public static readonly Guid MEDIASUBTYPE_WAVE = new Guid("e436eb8b-524f-11ce-9f53-0020af0ba770"); 25 | public static readonly Guid MEDIASUBTYPE_AU = new Guid("e436eb8c-524f-11ce-9f53-0020af0ba770"); 26 | public static readonly Guid MEDIASUBTYPE_AIFF = new Guid("e436eb8d-524f-11ce-9f53-0020af0ba770"); 27 | 28 | public static readonly Guid[] AudioSubTypes = new Guid[] 29 | { 30 | MEDIASUBTYPE_PCM, 31 | MEDIASUBTYPE_PCMAudioObsolete, 32 | MEDIASUBTYPE_MPEG1Packet, 33 | MEDIASUBTYPE_MPEG1Payload, 34 | MEDIASUBTYPE_MPEG2_AUDIO, 35 | MEDIASUBTYPE_DVD_LPCM_AUDIO, 36 | MEDIASUBTYPE_DRM_Audio, 37 | MEDIASUBTYPE_IEEE_FLOAT, 38 | MEDIASUBTYPE_DOLBY_AC3, 39 | MEDIASUBTYPE_DOLBY_AC3_SPDIF, 40 | MEDIASUBTYPE_RAW_SPORT, 41 | MEDIASUBTYPE_SPDIF_TAG_241h, 42 | WMMEDIASUBTYPE_MP3, 43 | }; 44 | 45 | public static readonly string[] AudioSubTypeNames = new string[] 46 | { 47 | "PCM", 48 | "PCM Obsolete", 49 | "MPEG1Packet", 50 | "MPEG1Payload", 51 | "MPEG2_AUDIO", 52 | "DVD_LPCM_AUDIO", 53 | "DRM_Audio", 54 | "IEEE_FLOAT", 55 | "DOLBY_AC3", 56 | "DOLBY_AC3_SPDIF", 57 | "RAW_SPORT", 58 | "SPDIF_TAG_241h", 59 | "MP3" 60 | }; 61 | public static string GetAudioSubtypeName(Guid subType) 62 | { 63 | for (int index = 0; index < AudioSubTypes.Length; index++) 64 | { 65 | if (subType == AudioSubTypes[index]) 66 | { 67 | return AudioSubTypeNames[index]; 68 | } 69 | } 70 | return subType.ToString(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/AudioMediaSubtypes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ee08990d14d50946a1ad3ad9c69e4d3 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/Gsm610WaveFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | using System.IO; 6 | 7 | namespace NAudio.Wave.WZT 8 | { 9 | /// 10 | /// GSM 610 11 | /// 12 | [StructLayout(LayoutKind.Sequential, Pack = 2)] 13 | public class Gsm610WaveFormat : WaveFormat 14 | { 15 | private short samplesPerBlock; 16 | 17 | /// 18 | /// Creates a GSM 610 WaveFormat 19 | /// For now hardcoded to 13kbps 20 | /// 21 | public Gsm610WaveFormat() 22 | { 23 | this.waveFormatTag = WaveFormatEncoding.Gsm610; 24 | this.channels = 1; 25 | this.averageBytesPerSecond = 1625; 26 | this.bitsPerSample = 0; // must be zero 27 | this.blockAlign = 65; 28 | this.sampleRate = 8000; 29 | 30 | this.extraSize = 2; 31 | this.samplesPerBlock = 320; 32 | } 33 | 34 | /// 35 | /// Samples per block 36 | /// 37 | public short SamplesPerBlock { get { return this.samplesPerBlock; } } 38 | 39 | /// 40 | /// Writes this structure to a BinaryWriter 41 | /// 42 | public override void Serialize(BinaryWriter writer) 43 | { 44 | base.Serialize(writer); 45 | writer.Write(samplesPerBlock); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/Gsm610WaveFormat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c029ee315c0c6834e90f04f619338b3b 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/IWaveProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NAudio.Lame; 3 | 4 | namespace NAudio.Wave.WZT 5 | { 6 | /// 7 | /// Generic interface for all WaveProviders. 8 | /// 9 | public interface IWaveProvider 10 | { 11 | /// 12 | /// Gets the WaveFormat of this WaveProvider. 13 | /// 14 | /// The wave format. 15 | WaveFormat WaveFormat { get; } 16 | 17 | /// 18 | /// Fill the specified buffer with wave data. 19 | /// 20 | /// The buffer to fill of wave data. 21 | /// Offset into buffer 22 | /// The number of bytes to read 23 | /// the number of bytes written to the buffer. 24 | int Read(byte[] buffer, int offset, int count); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/IWaveProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbfb88f187675b0448dcf66ca372dc8f 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/RiffChunk.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace NAudio.Wave.WZT 6 | { 7 | /// 8 | /// Holds information about a RIFF file chunk 9 | /// 10 | public class RiffChunk 11 | { 12 | int identifier; 13 | int length; 14 | long streamPosition; 15 | 16 | /// 17 | /// Creates a RiffChunk object 18 | /// 19 | public RiffChunk(int identifier, int length, long streamPosition) 20 | { 21 | this.identifier = identifier; 22 | this.length = length; 23 | this.streamPosition = streamPosition; 24 | } 25 | 26 | /// 27 | /// The chunk identifier 28 | /// 29 | public int Identifier 30 | { 31 | get 32 | { 33 | return identifier; 34 | } 35 | } 36 | 37 | /// 38 | /// The chunk identifier converted to a string 39 | /// 40 | public string IdentifierAsString 41 | { 42 | get 43 | { 44 | return ASCIIEncoding.ASCII.GetString(BitConverter.GetBytes(identifier)); 45 | } 46 | } 47 | 48 | /// 49 | /// The chunk length 50 | /// 51 | public int Length 52 | { 53 | get 54 | { 55 | return length; 56 | } 57 | } 58 | 59 | /// 60 | /// The stream position this chunk is located at 61 | /// 62 | public long StreamPosition 63 | { 64 | get 65 | { 66 | return streamPosition; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/RiffChunk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe306abf31fdbe64481deb697a77ba52 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFileReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | 7 | namespace NAudio.Wave.WZT 8 | { 9 | /// This class supports the reading of WAV files, 10 | /// providing a repositionable WaveStream that returns the raw data 11 | /// contained in the WAV file 12 | /// 13 | public class WaveFileReader : WaveStream 14 | { 15 | private WaveFormat waveFormat; 16 | private Stream waveStream; 17 | private bool ownInput; 18 | private long dataPosition; 19 | private int dataChunkLength; 20 | private List chunks = new List(); 21 | 22 | /// Supports opening a WAV file 23 | /// The WAV file format is a real mess, but we will only 24 | /// support the basic WAV file format which actually covers the vast 25 | /// majority of WAV files out there. For more WAV file format information 26 | /// visit www.wotsit.org. If you have a WAV file that can't be read by 27 | /// this class, email it to the NAudio project and we will probably 28 | /// fix this reader to support it 29 | /// 30 | public WaveFileReader(String waveFile) : 31 | this(File.OpenRead(waveFile)) 32 | { 33 | ownInput = true; 34 | } 35 | 36 | /// 37 | /// Creates a Wave File Reader based on an input stream 38 | /// 39 | /// The input stream containing a WAV file including header 40 | public WaveFileReader(Stream inputStream) 41 | { 42 | this.waveStream = inputStream; 43 | ReadWaveHeader(waveStream, out waveFormat, out dataPosition, out dataChunkLength, chunks); 44 | Position = 0; 45 | } 46 | 47 | /// 48 | /// Reads the header part of a WAV file from a stream 49 | /// 50 | /// The stream, positioned at the start of audio data 51 | /// The format found 52 | /// The position of the data chunk 53 | /// The length of the data chunk 54 | /// Additional chunks found 55 | public static void ReadWaveHeader(Stream stream, out WaveFormat format, out long dataChunkPosition, out int dataChunkLength, List chunks) 56 | { 57 | dataChunkPosition = -1; 58 | format = null; 59 | BinaryReader br = new BinaryReader(stream); 60 | if (Encoding.ASCII.GetString(br.ReadBytes(4)) != "RIFF")//WaveInterop.mmioStringToFOURCC("RIFF", 0) 61 | { 62 | throw new FormatException("Not a WAVE file - no RIFF header"); 63 | } 64 | uint fileSize = br.ReadUInt32(); // read the file size (minus 8 bytes) 65 | if (Encoding.ASCII.GetString(br.ReadBytes(4)) != "WAVE")//WaveInterop.mmioStringToFOURCC("WAVE", 0) 66 | { 67 | throw new FormatException("Not a WAVE file - no WAVE header"); 68 | } 69 | int dataChunkID = BitConverter.ToInt32(Encoding.UTF8.GetBytes("data"), 0); ;//WaveInterop.mmioStringToFOURCC("data", 0) 70 | int formatChunkId = BitConverter.ToInt32(Encoding.UTF8.GetBytes("fmt "), 0); ;//WaveInterop.mmioStringToFOURCC("fmt ", 0) 71 | dataChunkLength = 0; 72 | 73 | // sometimes a file has more data than is specified after the RIFF header 74 | long stopPosition = Math.Min(fileSize + 8, stream.Length); 75 | 76 | // this -8 is so we can be sure that there are at least 8 bytes for a chunk id and length 77 | while (stream.Position <= stopPosition - 8) 78 | { 79 | Int32 chunkIdentifier = br.ReadInt32(); 80 | Int32 chunkLength = br.ReadInt32(); 81 | if (chunkIdentifier == dataChunkID) 82 | { 83 | dataChunkPosition = stream.Position; 84 | dataChunkLength = chunkLength; 85 | stream.Position += chunkLength; 86 | } 87 | else if (chunkIdentifier == formatChunkId) 88 | { 89 | format = WaveFormat.FromFormatChunk(br, chunkLength); 90 | } 91 | else 92 | { 93 | // check for invalid chunk length 94 | if (chunkLength < 0 || chunkLength > stream.Length - stream.Position) 95 | { 96 | Debug.Assert(false, String.Format("Invalid chunk length {0}, pos: {1}. length: {2}", 97 | chunkLength, stream.Position, stream.Length)); 98 | // an exception will be thrown further down if we haven't got a format and data chunk yet, 99 | // otherwise we will tolerate this file despite it having corrupt data at the end 100 | break; 101 | } 102 | if (chunks != null) 103 | { 104 | chunks.Add(new RiffChunk(chunkIdentifier, chunkLength, stream.Position)); 105 | } 106 | stream.Position += chunkLength; 107 | } 108 | } 109 | 110 | if (format == null) 111 | { 112 | throw new FormatException("Invalid WAV file - No fmt chunk found"); 113 | } 114 | if (dataChunkPosition == -1) 115 | { 116 | throw new FormatException("Invalid WAV file - No data chunk found"); 117 | } 118 | } 119 | 120 | /// 121 | /// Gets a list of the additional chunks found in this file 122 | /// 123 | public List ExtraChunks 124 | { 125 | get 126 | { 127 | return chunks; 128 | } 129 | } 130 | 131 | /// 132 | /// Gets the data for the specified chunk 133 | /// 134 | public byte[] GetChunkData(RiffChunk chunk) 135 | { 136 | long oldPosition = waveStream.Position; 137 | waveStream.Position = chunk.StreamPosition; 138 | byte[] data = new byte[chunk.Length]; 139 | waveStream.Read(data, 0, data.Length); 140 | waveStream.Position = oldPosition; 141 | return data; 142 | } 143 | 144 | /// 145 | /// Cleans up the resources associated with this WaveFileReader 146 | /// 147 | protected override void Dispose(bool disposing) 148 | { 149 | if (disposing) 150 | { 151 | // Release managed resources. 152 | if (waveStream != null) 153 | { 154 | // only dispose our source if we created it 155 | if (ownInput) 156 | { 157 | waveStream.Close(); 158 | } 159 | waveStream = null; 160 | } 161 | } 162 | else 163 | { 164 | System.Diagnostics.Debug.Assert(false, "WaveFileReader was not disposed"); 165 | } 166 | // Release unmanaged resources. 167 | // Set large fields to null. 168 | // Call Dispose on your base class. 169 | base.Dispose(disposing); 170 | } 171 | 172 | /// 173 | /// 174 | /// 175 | public override WaveFormat WaveFormat 176 | { 177 | get 178 | { 179 | return waveFormat; 180 | } 181 | } 182 | 183 | /// 184 | /// This is the length of audio data contained in this WAV file, in bytes 185 | /// (i.e. the byte length of the data chunk, not the length of the WAV file itself) 186 | /// 187 | /// 188 | public override long Length 189 | { 190 | get 191 | { 192 | return dataChunkLength; 193 | } 194 | } 195 | 196 | /// 197 | /// Number of Samples (if possible to calculate) 198 | /// This currently does not take into account number of channels, so 199 | /// divide again by number of channels if you want the number of 200 | /// audio 'frames' 201 | /// 202 | public long SampleCount 203 | { 204 | get 205 | { 206 | if (waveFormat.Encoding == WaveFormatEncoding.Pcm || 207 | waveFormat.Encoding == WaveFormatEncoding.Extensible || 208 | waveFormat.Encoding == WaveFormatEncoding.IeeeFloat) 209 | { 210 | return dataChunkLength / BlockAlign; 211 | } 212 | else 213 | { 214 | // n.b. if there is a fact chunk, you can use that to get the number of samples 215 | throw new InvalidOperationException("Sample count is calculated only for the standard encodings"); 216 | } 217 | } 218 | } 219 | 220 | /// 221 | /// Position in the WAV data chunk. 222 | /// 223 | /// 224 | public override long Position 225 | { 226 | get 227 | { 228 | return waveStream.Position - dataPosition; 229 | } 230 | set 231 | { 232 | lock (this) 233 | { 234 | value = Math.Min(value, Length); 235 | // make sure we don't get out of sync 236 | value -= (value % waveFormat.BlockAlign); 237 | waveStream.Position = value + dataPosition; 238 | } 239 | } 240 | } 241 | 242 | /// 243 | /// Reads bytes from the Wave File 244 | /// 245 | /// 246 | public override int Read(byte[] array, int offset, int count) 247 | { 248 | if (count % waveFormat.BlockAlign != 0) 249 | { 250 | throw new ArgumentException(String.Format("Must read complete blocks: requested {0}, block align is {1}", count, this.WaveFormat.BlockAlign)); 251 | } 252 | // sometimes there is more junk at the end of the file past the data chunk 253 | if (Position + count > dataChunkLength) 254 | { 255 | count = dataChunkLength - (int)Position; 256 | } 257 | return waveStream.Read(array, offset, count); 258 | } 259 | 260 | /// 261 | /// Attempts to read a sample into a float. n.b. only applicable for uncompressed formats 262 | /// Will normalise the value read into the range -1.0f to 1.0f if it comes from a PCM encoding 263 | /// 264 | /// False if the end of the WAV data chunk was reached 265 | public bool TryReadFloat(out float sampleValue) 266 | { 267 | sampleValue = 0.0f; 268 | // 16 bit PCM data 269 | if (waveFormat.BitsPerSample == 16) 270 | { 271 | byte[] value = new byte[2]; 272 | int read = Read(value, 0, 2); 273 | if (read < 2) 274 | return false; 275 | sampleValue = (float)BitConverter.ToInt16(value, 0) / 32768f; 276 | return true; 277 | } 278 | // 24 bit PCM data 279 | else if (waveFormat.BitsPerSample == 24) 280 | { 281 | byte[] value = new byte[4]; 282 | int read = Read(value, 0, 3); 283 | if (read < 3) 284 | return false; 285 | if (value[2] > 0x7f) 286 | { 287 | value[3] = 0xff; 288 | } 289 | else 290 | { 291 | value[3] = 0x00; 292 | } 293 | sampleValue = (float)BitConverter.ToInt32(value, 0) / (float)(0x800000); 294 | return true; 295 | } 296 | // 32 bit PCM data 297 | if (waveFormat.BitsPerSample == 32 && waveFormat.Encoding == WaveFormatEncoding.Extensible) 298 | { 299 | byte[] value = new byte[4]; 300 | int read = Read(value, 0, 4); 301 | if (read < 4) 302 | return false; 303 | sampleValue = (float)BitConverter.ToInt32(value, 0) / ((float)(Int32.MaxValue) + 1f); 304 | return true; 305 | } 306 | // IEEE float data 307 | if (waveFormat.BitsPerSample == 32 && waveFormat.Encoding == WaveFormatEncoding.IeeeFloat) 308 | { 309 | byte[] value = new byte[4]; 310 | int read = Read(value, 0, 4); 311 | if (read < 4) 312 | return false; 313 | sampleValue = BitConverter.ToSingle(value, 0); 314 | return true; 315 | } 316 | else 317 | { 318 | throw new ApplicationException("Only 16, 24 or 32 bit PCM or IEEE float audio data supported"); 319 | } 320 | } 321 | } 322 | } 323 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFileReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8920394775cdb6438bd7656c5c68841 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.InteropServices; 4 | using System.Diagnostics; 5 | 6 | namespace NAudio.Wave.WZT 7 | { 8 | /// 9 | /// Represents a Wave file format 10 | /// 11 | [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=2)] 12 | public class WaveFormat 13 | { 14 | /// format type 15 | protected WaveFormatEncoding waveFormatTag; 16 | /// number of channels 17 | protected short channels; 18 | /// sample rate 19 | protected int sampleRate; 20 | /// for buffer estimation 21 | protected int averageBytesPerSecond; 22 | /// block size of data 23 | protected short blockAlign; 24 | /// number of bits per sample of mono data 25 | protected short bitsPerSample; 26 | /// number of following bytes 27 | protected short extraSize; 28 | 29 | /// 30 | /// Creates a new PCM 44.1Khz stereo 16 bit format 31 | /// 32 | public WaveFormat() : this(44100,16,2) 33 | { 34 | 35 | } 36 | 37 | /// 38 | /// Creates a new 16 bit wave format with the specified sample 39 | /// rate and channel count 40 | /// 41 | /// Sample Rate 42 | /// Number of channels 43 | public WaveFormat(int sampleRate, int channels) 44 | : this(sampleRate, 16, channels) 45 | { 46 | } 47 | 48 | /// 49 | /// Gets the size of a wave buffer equivalent to the latency in milliseconds. 50 | /// 51 | /// The milliseconds. 52 | /// 53 | public int ConvertLatencyToByteSize(int milliseconds) 54 | { 55 | int bytes = (int) ((AverageBytesPerSecond/1000.0)*milliseconds); 56 | if ((bytes%BlockAlign) != 0) 57 | { 58 | // Return the upper BlockAligned 59 | bytes = bytes + BlockAlign - (bytes % BlockAlign); 60 | } 61 | return bytes; 62 | } 63 | 64 | /// 65 | /// Creates a WaveFormat with custom members 66 | /// 67 | /// The encoding 68 | /// Sample Rate 69 | /// Number of channels 70 | /// Average Bytes Per Second 71 | /// Block Align 72 | /// Bits Per Sample 73 | /// 74 | public static WaveFormat CreateCustomFormat(WaveFormatEncoding tag, int sampleRate, int channels, int averageBytesPerSecond, int blockAlign, int bitsPerSample) 75 | { 76 | WaveFormat waveFormat = new WaveFormat(); 77 | waveFormat.waveFormatTag = tag; 78 | waveFormat.channels = (short)channels; 79 | waveFormat.sampleRate = sampleRate; 80 | waveFormat.averageBytesPerSecond = averageBytesPerSecond; 81 | waveFormat.blockAlign = (short)blockAlign; 82 | waveFormat.bitsPerSample = (short)bitsPerSample; 83 | waveFormat.extraSize = 0; 84 | return waveFormat; 85 | } 86 | 87 | /// 88 | /// Creates an A-law wave format 89 | /// 90 | /// Sample Rate 91 | /// Number of Channels 92 | /// Wave Format 93 | public static WaveFormat CreateALawFormat(int sampleRate, int channels) 94 | { 95 | return CreateCustomFormat(WaveFormatEncoding.ALaw, sampleRate, channels, sampleRate * channels, 1, 8); 96 | } 97 | 98 | /// 99 | /// Creates a Mu-law wave format 100 | /// 101 | /// Sample Rate 102 | /// Number of Channels 103 | /// Wave Format 104 | public static WaveFormat CreateMuLawFormat(int sampleRate, int channels) 105 | { 106 | return CreateCustomFormat(WaveFormatEncoding.MuLaw, sampleRate, channels, sampleRate * channels, 1, 8); 107 | } 108 | 109 | /// 110 | /// Creates a new PCM format with the specified sample rate, bit depth and channels 111 | /// 112 | public WaveFormat(int rate, int bits, int channels) 113 | { 114 | if (channels < 1) 115 | { 116 | throw new ArgumentOutOfRangeException("Channels must be 1 or greater", "channels"); 117 | } 118 | // minimum 16 bytes, sometimes 18 for PCM 119 | this.waveFormatTag = WaveFormatEncoding.Pcm; 120 | this.channels = (short)channels; 121 | this.sampleRate = rate; 122 | this.bitsPerSample = (short)bits; 123 | this.extraSize = 0; 124 | 125 | this.blockAlign = (short)(channels * (bits / 8)); 126 | this.averageBytesPerSecond = this.sampleRate * this.blockAlign; 127 | } 128 | 129 | /// 130 | /// Creates a new 32 bit IEEE floating point wave format 131 | /// 132 | /// sample rate 133 | /// number of channels 134 | public static WaveFormat CreateIeeeFloatWaveFormat(int sampleRate, int channels) 135 | { 136 | WaveFormat wf = new WaveFormat(); 137 | wf.waveFormatTag = WaveFormatEncoding.IeeeFloat; 138 | wf.channels = (short)channels; 139 | wf.bitsPerSample = 32; 140 | wf.sampleRate = sampleRate; 141 | wf.blockAlign = (short) (4*channels); 142 | wf.averageBytesPerSecond = sampleRate * wf.blockAlign; 143 | wf.extraSize = 0; 144 | return wf; 145 | } 146 | 147 | /// 148 | /// Helper function to retrieve a WaveFormat structure from a pointer 149 | /// 150 | /// WaveFormat structure 151 | /// 152 | public static WaveFormat MarshalFromPtr(IntPtr pointer) 153 | { 154 | WaveFormat waveFormat = (WaveFormat)Marshal.PtrToStructure(pointer, typeof(WaveFormat)); 155 | switch (waveFormat.Encoding) 156 | { 157 | case WaveFormatEncoding.Pcm: 158 | // can't rely on extra size even being there for PCM so blank it to avoid reading 159 | // corrupt data 160 | waveFormat.extraSize = 0; 161 | break; 162 | case WaveFormatEncoding.Extensible: 163 | waveFormat = (WaveFormatExtensible)Marshal.PtrToStructure(pointer, typeof(WaveFormatExtensible)); 164 | break; 165 | case WaveFormatEncoding.Adpcm: 166 | waveFormat = (AdpcmWaveFormat)Marshal.PtrToStructure(pointer, typeof(AdpcmWaveFormat)); 167 | break; 168 | case WaveFormatEncoding.Gsm610: 169 | waveFormat = (Gsm610WaveFormat)Marshal.PtrToStructure(pointer, typeof(Gsm610WaveFormat)); 170 | break; 171 | default: 172 | if (waveFormat.ExtraSize > 0) 173 | { 174 | waveFormat = (WaveFormatExtraData)Marshal.PtrToStructure(pointer, typeof(WaveFormatExtraData)); 175 | } 176 | break; 177 | } 178 | return waveFormat; 179 | } 180 | 181 | /// 182 | /// Helper function to marshal WaveFormat to an IntPtr 183 | /// 184 | /// WaveFormat 185 | /// IntPtr to WaveFormat structure (needs to be freed by callee) 186 | public static IntPtr MarshalToPtr(WaveFormat format) 187 | { 188 | int formatSize = Marshal.SizeOf(format); 189 | IntPtr formatPointer = Marshal.AllocHGlobal(formatSize); 190 | Marshal.StructureToPtr(format, formatPointer, false); 191 | return formatPointer; 192 | } 193 | 194 | /// 195 | /// Reads in a WaveFormat (with extra data) from a fmt chunk (chunk identifier and 196 | /// length should already have been read) 197 | /// 198 | /// Binary reader 199 | /// Format chunk length 200 | /// A WaveFormatExtraData 201 | public static WaveFormat FromFormatChunk(BinaryReader br, int formatChunkLength) 202 | { 203 | WaveFormatExtraData waveFormat = new WaveFormatExtraData(); 204 | waveFormat.ReadWaveFormat(br, formatChunkLength); 205 | waveFormat.ReadExtraData(br); 206 | return waveFormat; 207 | } 208 | 209 | private void ReadWaveFormat(BinaryReader br, int formatChunkLength) 210 | { 211 | if (formatChunkLength < 16) 212 | throw new ApplicationException("Invalid WaveFormat Structure"); 213 | this.waveFormatTag = (WaveFormatEncoding)br.ReadUInt16(); 214 | this.channels = br.ReadInt16(); 215 | this.sampleRate = br.ReadInt32(); 216 | this.averageBytesPerSecond = br.ReadInt32(); 217 | this.blockAlign = br.ReadInt16(); 218 | this.bitsPerSample = br.ReadInt16(); 219 | if (formatChunkLength > 16) 220 | { 221 | this.extraSize = br.ReadInt16(); 222 | if (this.extraSize != formatChunkLength - 18) 223 | { 224 | Debug.WriteLine("Format chunk mismatch"); 225 | this.extraSize = (short)(formatChunkLength - 18); 226 | } 227 | } 228 | } 229 | 230 | /// 231 | /// Reads a new WaveFormat object from a stream 232 | /// 233 | /// A binary reader that wraps the stream 234 | public WaveFormat(BinaryReader br) 235 | { 236 | int formatChunkLength = br.ReadInt32(); 237 | this.ReadWaveFormat(br, formatChunkLength); 238 | } 239 | 240 | /// 241 | /// Reports this WaveFormat as a string 242 | /// 243 | /// String describing the wave format 244 | public override string ToString() 245 | { 246 | switch (this.waveFormatTag) 247 | { 248 | case WaveFormatEncoding.Pcm: 249 | case WaveFormatEncoding.Extensible: 250 | // extensible just has some extra bits after the PCM header 251 | return String.Format("{0} bit PCM: {1}kHz {2} channels", 252 | bitsPerSample, sampleRate / 1000, channels); 253 | default: 254 | return this.waveFormatTag.ToString(); 255 | } 256 | } 257 | 258 | /// 259 | /// Compares with another WaveFormat object 260 | /// 261 | /// Object to compare to 262 | /// True if the objects are the same 263 | public override bool Equals(object obj) 264 | { 265 | WaveFormat other = obj as WaveFormat; 266 | if(other != null) 267 | { 268 | return waveFormatTag == other.waveFormatTag && 269 | channels == other.channels && 270 | sampleRate == other.sampleRate && 271 | averageBytesPerSecond == other.averageBytesPerSecond && 272 | blockAlign == other.blockAlign && 273 | bitsPerSample == other.bitsPerSample; 274 | } 275 | return false; 276 | } 277 | 278 | /// 279 | /// Provides a Hashcode for this WaveFormat 280 | /// 281 | /// A hashcode 282 | public override int GetHashCode() 283 | { 284 | return (int) waveFormatTag ^ 285 | (int) channels ^ 286 | sampleRate ^ 287 | averageBytesPerSecond ^ 288 | (int) blockAlign ^ 289 | (int) bitsPerSample; 290 | } 291 | 292 | /// 293 | /// Returns the encoding type used 294 | /// 295 | public WaveFormatEncoding Encoding 296 | { 297 | get 298 | { 299 | return waveFormatTag; 300 | } 301 | } 302 | 303 | /// 304 | /// Writes this WaveFormat object to a stream 305 | /// 306 | /// the output stream 307 | public virtual void Serialize(BinaryWriter writer) 308 | { 309 | writer.Write((int)(18 + extraSize)); // wave format length 310 | writer.Write((short)Encoding); 311 | writer.Write((short)Channels); 312 | writer.Write((int)SampleRate); 313 | writer.Write((int)AverageBytesPerSecond); 314 | writer.Write((short)BlockAlign); 315 | writer.Write((short)BitsPerSample); 316 | writer.Write((short)extraSize); 317 | } 318 | 319 | /// 320 | /// Returns the number of channels (1=mono,2=stereo etc) 321 | /// 322 | public int Channels 323 | { 324 | get 325 | { 326 | return channels; 327 | } 328 | } 329 | 330 | /// 331 | /// Returns the sample rate (samples per second) 332 | /// 333 | public int SampleRate 334 | { 335 | get 336 | { 337 | return sampleRate; 338 | } 339 | } 340 | 341 | /// 342 | /// Returns the average number of bytes used per second 343 | /// 344 | public int AverageBytesPerSecond 345 | { 346 | get 347 | { 348 | return averageBytesPerSecond; 349 | } 350 | } 351 | 352 | /// 353 | /// Returns the block alignment 354 | /// 355 | public virtual int BlockAlign 356 | { 357 | get 358 | { 359 | return blockAlign; 360 | } 361 | } 362 | 363 | /// 364 | /// Returns the number of bits per sample (usually 16 or 32, sometimes 24 or 8) 365 | /// Can be 0 for some codecs 366 | /// 367 | public int BitsPerSample 368 | { 369 | get 370 | { 371 | return bitsPerSample; 372 | } 373 | } 374 | 375 | /// 376 | /// Returns the number of extra bytes used by this waveformat. Often 0, 377 | /// except for compressed formats which store extra data after the WAVEFORMATEX header 378 | /// 379 | public int ExtraSize 380 | { 381 | get 382 | { 383 | return extraSize; 384 | } 385 | } 386 | 387 | 388 | } 389 | } 390 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f709c5c91c6ee1347bbdbfb71e25563d 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormatEncoding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NAudio.Wave.WZT 4 | { 5 | /// 6 | /// Summary description for WaveFormatEncoding. 7 | /// 8 | public enum WaveFormatEncoding : ushort 9 | { 10 | /// WAVE_FORMAT_UNKNOWN, Microsoft Corporation 11 | Unknown = 0x0000, 12 | /// WAVE_FORMAT_PCM Microsoft Corporation 13 | Pcm = 0x0001, 14 | /// WAVE_FORMAT_ADPCM Microsoft Corporation 15 | Adpcm = 0x0002, 16 | /// WAVE_FORMAT_IEEE_FLOAT Microsoft Corporation 17 | IeeeFloat = 0x0003, 18 | /// WAVE_FORMAT_VSELP Compaq Computer Corp. 19 | Vselp = 0x0004, 20 | /// WAVE_FORMAT_IBM_CVSD IBM Corporation 21 | IbmCvsd = 0x0005, 22 | /// WAVE_FORMAT_ALAW Microsoft Corporation 23 | ALaw = 0x0006, 24 | /// WAVE_FORMAT_MULAW Microsoft Corporation 25 | MuLaw = 0x0007, 26 | /// WAVE_FORMAT_DTS Microsoft Corporation 27 | Dts = 0x0008, 28 | /// WAVE_FORMAT_DRM Microsoft Corporation 29 | Drm = 0x0009, 30 | /// WAVE_FORMAT_OKI_ADPCM OKI 31 | OkiAdpcm = 0x0010, 32 | /// WAVE_FORMAT_DVI_ADPCM Intel Corporation 33 | DviAdpcm = 0x0011, 34 | /// WAVE_FORMAT_IMA_ADPCM Intel Corporation 35 | ImaAdpcm = DviAdpcm, 36 | /// WAVE_FORMAT_MEDIASPACE_ADPCM Videologic 37 | MediaspaceAdpcm = 0x0012, 38 | /// WAVE_FORMAT_SIERRA_ADPCM Sierra Semiconductor Corp 39 | SierraAdpcm = 0x0013, 40 | /// WAVE_FORMAT_G723_ADPCM Antex Electronics Corporation 41 | G723Adpcm = 0x0014, 42 | /// WAVE_FORMAT_DIGISTD DSP Solutions, Inc. 43 | DigiStd = 0x0015, 44 | /// WAVE_FORMAT_DIGIFIX DSP Solutions, Inc. 45 | DigiFix = 0x0016, 46 | /// WAVE_FORMAT_DIALOGIC_OKI_ADPCM Dialogic Corporation 47 | DialogicOkiAdpcm = 0x0017, 48 | /// WAVE_FORMAT_MEDIAVISION_ADPCM Media Vision, Inc. 49 | MediaVisionAdpcm = 0x0018, 50 | /// WAVE_FORMAT_CU_CODEC Hewlett-Packard Company 51 | CUCodec = 0x0019, 52 | /// WAVE_FORMAT_YAMAHA_ADPCM Yamaha Corporation of America 53 | YamahaAdpcm = 0x0020, 54 | /// WAVE_FORMAT_SONARC Speech Compression 55 | SonarC = 0x0021, 56 | /// WAVE_FORMAT_DSPGROUP_TRUESPEECH DSP Group, Inc 57 | DspGroupTrueSpeech = 0x0022, 58 | /// WAVE_FORMAT_ECHOSC1 Echo Speech Corporation 59 | EchoSpeechCorporation1 = 0x0023, 60 | /// WAVE_FORMAT_AUDIOFILE_AF36, Virtual Music, Inc. 61 | AudioFileAf36 = 0x0024, 62 | /// WAVE_FORMAT_APTX Audio Processing Technology 63 | Aptx = 0x0025, 64 | /// WAVE_FORMAT_AUDIOFILE_AF10, Virtual Music, Inc. 65 | AudioFileAf10 = 0x0026, 66 | /// WAVE_FORMAT_PROSODY_1612, Aculab plc 67 | Prosody1612 = 0x0027, 68 | /// WAVE_FORMAT_LRC, Merging Technologies S.A. 69 | Lrc = 0x0028, 70 | /// WAVE_FORMAT_DOLBY_AC2, Dolby Laboratories 71 | DolbyAc2 = 0x0030, 72 | /// WAVE_FORMAT_GSM610, Microsoft Corporation 73 | Gsm610 = 0x0031, 74 | /// WAVE_FORMAT_MSNAUDIO, Microsoft Corporation 75 | MsnAudio = 0x0032, 76 | /// WAVE_FORMAT_ANTEX_ADPCME, Antex Electronics Corporation 77 | AntexAdpcme = 0x0033, 78 | /// WAVE_FORMAT_CONTROL_RES_VQLPC, Control Resources Limited 79 | ControlResVqlpc = 0x0034, 80 | /// WAVE_FORMAT_DIGIREAL, DSP Solutions, Inc. 81 | DigiReal = 0x0035, 82 | /// WAVE_FORMAT_DIGIADPCM, DSP Solutions, Inc. 83 | DigiAdpcm = 0x0036, 84 | /// WAVE_FORMAT_CONTROL_RES_CR10, Control Resources Limited 85 | ControlResCr10 = 0x0037, 86 | /// 87 | WAVE_FORMAT_NMS_VBXADPCM = 0x0038, // Natural MicroSystems 88 | /// 89 | WAVE_FORMAT_CS_IMAADPCM = 0x0039, // Crystal Semiconductor IMA ADPCM 90 | /// 91 | WAVE_FORMAT_ECHOSC3 = 0x003A, // Echo Speech Corporation 92 | /// 93 | WAVE_FORMAT_ROCKWELL_ADPCM = 0x003B, // Rockwell International 94 | /// 95 | WAVE_FORMAT_ROCKWELL_DIGITALK = 0x003C, // Rockwell International 96 | /// 97 | WAVE_FORMAT_XEBEC = 0x003D, // Xebec Multimedia Solutions Limited 98 | /// 99 | WAVE_FORMAT_G721_ADPCM = 0x0040, // Antex Electronics Corporation 100 | /// 101 | WAVE_FORMAT_G728_CELP = 0x0041, // Antex Electronics Corporation 102 | /// 103 | WAVE_FORMAT_MSG723 = 0x0042, // Microsoft Corporation 104 | /// 105 | Mpeg = 0x0050, // WAVE_FORMAT_MPEG, Microsoft Corporation 106 | /// 107 | WAVE_FORMAT_RT24 = 0x0052, // InSoft, Inc. 108 | /// 109 | WAVE_FORMAT_PAC = 0x0053, // InSoft, Inc. 110 | /// 111 | MpegLayer3 = 0x0055, // WAVE_FORMAT_MPEGLAYER3, ISO/MPEG Layer3 Format Tag 112 | /// 113 | WAVE_FORMAT_LUCENT_G723 = 0x0059, // Lucent Technologies 114 | /// 115 | WAVE_FORMAT_CIRRUS = 0x0060, // Cirrus Logic 116 | /// 117 | WAVE_FORMAT_ESPCM = 0x0061, // ESS Technology 118 | /// 119 | WAVE_FORMAT_VOXWARE = 0x0062, // Voxware Inc 120 | /// 121 | WAVE_FORMAT_CANOPUS_ATRAC = 0x0063, // Canopus, co., Ltd. 122 | /// 123 | WAVE_FORMAT_G726_ADPCM = 0x0064, // APICOM 124 | /// 125 | WAVE_FORMAT_G722_ADPCM = 0x0065, // APICOM 126 | /// 127 | WAVE_FORMAT_DSAT_DISPLAY = 0x0067, // Microsoft Corporation 128 | /// 129 | WAVE_FORMAT_VOXWARE_BYTE_ALIGNED = 0x0069, // Voxware Inc 130 | /// 131 | WAVE_FORMAT_VOXWARE_AC8 = 0x0070, // Voxware Inc 132 | /// 133 | WAVE_FORMAT_VOXWARE_AC10 = 0x0071, // Voxware Inc 134 | /// 135 | WAVE_FORMAT_VOXWARE_AC16 = 0x0072, // Voxware Inc 136 | /// 137 | WAVE_FORMAT_VOXWARE_AC20 = 0x0073, // Voxware Inc 138 | /// 139 | WAVE_FORMAT_VOXWARE_RT24 = 0x0074, // Voxware Inc 140 | /// 141 | WAVE_FORMAT_VOXWARE_RT29 = 0x0075, // Voxware Inc 142 | /// 143 | WAVE_FORMAT_VOXWARE_RT29HW = 0x0076, // Voxware Inc 144 | /// 145 | WAVE_FORMAT_VOXWARE_VR12 = 0x0077, // Voxware Inc 146 | /// 147 | WAVE_FORMAT_VOXWARE_VR18 = 0x0078, // Voxware Inc 148 | /// 149 | WAVE_FORMAT_VOXWARE_TQ40 = 0x0079, // Voxware Inc 150 | /// 151 | WAVE_FORMAT_SOFTSOUND = 0x0080, // Softsound, Ltd. 152 | /// 153 | WAVE_FORMAT_VOXWARE_TQ60 = 0x0081, // Voxware Inc 154 | /// 155 | WAVE_FORMAT_MSRT24 = 0x0082, // Microsoft Corporation 156 | /// 157 | WAVE_FORMAT_G729A = 0x0083, // AT&T Labs, Inc. 158 | /// 159 | WAVE_FORMAT_MVI_MVI2 = 0x0084, // Motion Pixels 160 | /// 161 | WAVE_FORMAT_DF_G726 = 0x0085, // DataFusion Systems (Pty) (Ltd) 162 | /// 163 | WAVE_FORMAT_DF_GSM610 = 0x0086, // DataFusion Systems (Pty) (Ltd) 164 | /// 165 | WAVE_FORMAT_ISIAUDIO = 0x0088, // Iterated Systems, Inc. 166 | /// 167 | WAVE_FORMAT_ONLIVE = 0x0089, // OnLive! Technologies, Inc. 168 | /// 169 | WAVE_FORMAT_SBC24 = 0x0091, // Siemens Business Communications Sys 170 | /// 171 | WAVE_FORMAT_DOLBY_AC3_SPDIF = 0x0092, // Sonic Foundry 172 | /// 173 | WAVE_FORMAT_MEDIASONIC_G723 = 0x0093, // MediaSonic 174 | /// 175 | WAVE_FORMAT_PROSODY_8KBPS = 0x0094, // Aculab plc 176 | /// 177 | WAVE_FORMAT_ZYXEL_ADPCM = 0x0097, // ZyXEL Communications, Inc. 178 | /// 179 | WAVE_FORMAT_PHILIPS_LPCBB = 0x0098, // Philips Speech Processing 180 | /// 181 | WAVE_FORMAT_PACKED = 0x0099, // Studer Professional Audio AG 182 | /// 183 | WAVE_FORMAT_MALDEN_PHONYTALK = 0x00A0, // Malden Electronics Ltd. 184 | /// WAVE_FORMAT_GSM 185 | Gsm = 0x00A1, 186 | /// WAVE_FORMAT_G729 187 | G729 = 0x00A2, 188 | /// WAVE_FORMAT_G723 189 | G723 = 0x00A3, 190 | /// WAVE_FORMAT_ACELP 191 | Acelp = 0x00A4, 192 | /// 193 | WAVE_FORMAT_RHETOREX_ADPCM = 0x0100, // Rhetorex Inc. 194 | /// 195 | WAVE_FORMAT_IRAT = 0x0101, // BeCubed Software Inc. 196 | /// 197 | WAVE_FORMAT_VIVO_G723 = 0x0111, // Vivo Software 198 | /// 199 | WAVE_FORMAT_VIVO_SIREN = 0x0112, // Vivo Software 200 | /// 201 | WAVE_FORMAT_DIGITAL_G723 = 0x0123, // Digital Equipment Corporation 202 | /// 203 | WAVE_FORMAT_SANYO_LD_ADPCM = 0x0125, // Sanyo Electric Co., Ltd. 204 | /// 205 | WAVE_FORMAT_SIPROLAB_ACEPLNET = 0x0130, // Sipro Lab Telecom Inc. 206 | /// 207 | WAVE_FORMAT_SIPROLAB_ACELP4800 = 0x0131, // Sipro Lab Telecom Inc. 208 | /// 209 | WAVE_FORMAT_SIPROLAB_ACELP8V3 = 0x0132, // Sipro Lab Telecom Inc. 210 | /// 211 | WAVE_FORMAT_SIPROLAB_G729 = 0x0133, // Sipro Lab Telecom Inc. 212 | /// 213 | WAVE_FORMAT_SIPROLAB_G729A = 0x0134, // Sipro Lab Telecom Inc. 214 | /// 215 | WAVE_FORMAT_SIPROLAB_KELVIN = 0x0135, // Sipro Lab Telecom Inc. 216 | /// 217 | WAVE_FORMAT_G726ADPCM = 0x0140, // Dictaphone Corporation 218 | /// 219 | WAVE_FORMAT_QUALCOMM_PUREVOICE = 0x0150, // Qualcomm, Inc. 220 | /// 221 | WAVE_FORMAT_QUALCOMM_HALFRATE = 0x0151, // Qualcomm, Inc. 222 | /// 223 | WAVE_FORMAT_TUBGSM = 0x0155, // Ring Zero Systems, Inc. 224 | /// 225 | WAVE_FORMAT_MSAUDIO1 = 0x0160, // Microsoft Corporation 226 | /// 227 | /// WAVE_FORMAT_WMAUDIO2, Microsoft Corporation 228 | /// 229 | WAVE_FORMAT_WMAUDIO2 = 0x0161, 230 | /// 231 | /// WAVE_FORMAT_WMAUDIO3, Microsoft Corporation 232 | /// 233 | WAVE_FORMAT_WMAUDIO3 = 0x0162, 234 | /// 235 | WAVE_FORMAT_UNISYS_NAP_ADPCM = 0x0170, // Unisys Corp. 236 | /// 237 | WAVE_FORMAT_UNISYS_NAP_ULAW = 0x0171, // Unisys Corp. 238 | /// 239 | WAVE_FORMAT_UNISYS_NAP_ALAW = 0x0172, // Unisys Corp. 240 | /// 241 | WAVE_FORMAT_UNISYS_NAP_16K = 0x0173, // Unisys Corp. 242 | /// 243 | WAVE_FORMAT_CREATIVE_ADPCM = 0x0200, // Creative Labs, Inc 244 | /// 245 | WAVE_FORMAT_CREATIVE_FASTSPEECH8 = 0x0202, // Creative Labs, Inc 246 | /// 247 | WAVE_FORMAT_CREATIVE_FASTSPEECH10 = 0x0203, // Creative Labs, Inc 248 | /// 249 | WAVE_FORMAT_UHER_ADPCM = 0x0210, // UHER informatic GmbH 250 | /// 251 | WAVE_FORMAT_QUARTERDECK = 0x0220, // Quarterdeck Corporation 252 | /// 253 | WAVE_FORMAT_ILINK_VC = 0x0230, // I-link Worldwide 254 | /// 255 | WAVE_FORMAT_RAW_SPORT = 0x0240, // Aureal Semiconductor 256 | /// 257 | WAVE_FORMAT_ESST_AC3 = 0x0241, // ESS Technology, Inc. 258 | /// 259 | WAVE_FORMAT_IPI_HSX = 0x0250, // Interactive Products, Inc. 260 | /// 261 | WAVE_FORMAT_IPI_RPELP = 0x0251, // Interactive Products, Inc. 262 | /// 263 | WAVE_FORMAT_CS2 = 0x0260, // Consistent Software 264 | /// 265 | WAVE_FORMAT_SONY_SCX = 0x0270, // Sony Corp. 266 | /// 267 | WAVE_FORMAT_FM_TOWNS_SND = 0x0300, // Fujitsu Corp. 268 | /// 269 | WAVE_FORMAT_BTV_DIGITAL = 0x0400, // Brooktree Corporation 270 | /// 271 | WAVE_FORMAT_QDESIGN_MUSIC = 0x0450, // QDesign Corporation 272 | /// 273 | WAVE_FORMAT_VME_VMPCM = 0x0680, // AT&T Labs, Inc. 274 | /// 275 | WAVE_FORMAT_TPC = 0x0681, // AT&T Labs, Inc. 276 | /// 277 | WAVE_FORMAT_OLIGSM = 0x1000, // Ing C. Olivetti & C., S.p.A. 278 | /// 279 | WAVE_FORMAT_OLIADPCM = 0x1001, // Ing C. Olivetti & C., S.p.A. 280 | /// 281 | WAVE_FORMAT_OLICELP = 0x1002, // Ing C. Olivetti & C., S.p.A. 282 | /// 283 | WAVE_FORMAT_OLISBC = 0x1003, // Ing C. Olivetti & C., S.p.A. 284 | /// 285 | WAVE_FORMAT_OLIOPR = 0x1004, // Ing C. Olivetti & C., S.p.A. 286 | /// 287 | WAVE_FORMAT_LH_CODEC = 0x1100, // Lernout & Hauspie 288 | /// 289 | WAVE_FORMAT_NORRIS = 0x1400, // Norris Communications, Inc. 290 | /// 291 | WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS = 0x1500, // AT&T Labs, Inc. 292 | /// 293 | WAVE_FORMAT_DVM = 0x2000, // FAST Multimedia AG 294 | /// WAVE_FORMAT_EXTENSIBLE 295 | Extensible = 0xFFFE, // Microsoft 296 | /// 297 | WAVE_FORMAT_DEVELOPMENT = 0xFFFF, 298 | 299 | // others - not from MS headers 300 | /// WAVE_FORMAT_VORBIS1 "Og" Original stream compatible 301 | Vorbis1 = 0x674f, 302 | /// WAVE_FORMAT_VORBIS2 "Pg" Have independent header 303 | Vorbis2 = 0x6750, 304 | /// WAVE_FORMAT_VORBIS3 "Qg" Have no codebook header 305 | Vorbis3 = 0x6751, 306 | /// WAVE_FORMAT_VORBIS1P "og" Original stream compatible 307 | Vorbis1P = 0x676f, 308 | /// WAVE_FORMAT_VORBIS2P "pg" Have independent headere 309 | Vorbis2P = 0x6770, 310 | /// WAVE_FORMAT_VORBIS3P "qg" Have no codebook header 311 | Vorbis3P = 0x6771, 312 | 313 | } 314 | } 315 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormatEncoding.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07c489cad6787a04eadcc0f7b39dfc3e 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormatExtensible.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | using NAudio.Dmo.WZT; 6 | 7 | namespace NAudio.Wave.WZT 8 | { 9 | /// 10 | /// WaveFormatExtensible 11 | /// http://www.microsoft.com/whdc/device/audio/multichaud.mspx 12 | /// 13 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)] 14 | public class WaveFormatExtensible : WaveFormat 15 | { 16 | short wValidBitsPerSample; // bits of precision, or is wSamplesPerBlock if wBitsPerSample==0 17 | int dwChannelMask; // which channels are present in stream 18 | Guid subFormat; 19 | 20 | /// 21 | /// Parameterless constructor for marshalling 22 | /// 23 | WaveFormatExtensible() 24 | { 25 | } 26 | 27 | /// 28 | /// Creates a new WaveFormatExtensible for PCM or IEEE 29 | /// 30 | public WaveFormatExtensible(int rate, int bits, int channels) 31 | : base(rate, bits, channels) 32 | { 33 | waveFormatTag = WaveFormatEncoding.Extensible; 34 | extraSize = 22; 35 | wValidBitsPerSample = (short) bits; 36 | for (int n = 0; n < channels; n++) 37 | { 38 | dwChannelMask |= (1 << n); 39 | } 40 | if (bits == 32) 41 | { 42 | // KSDATAFORMAT_SUBTYPE_IEEE_FLOAT 43 | subFormat = AudioMediaSubtypes.MEDIASUBTYPE_IEEE_FLOAT; // new Guid("00000003-0000-0010-8000-00aa00389b71"); 44 | } 45 | else 46 | { 47 | // KSDATAFORMAT_SUBTYPE_PCM 48 | subFormat = AudioMediaSubtypes.MEDIASUBTYPE_PCM; // new Guid("00000001-0000-0010-8000-00aa00389b71"); 49 | } 50 | 51 | } 52 | 53 | /// 54 | /// SubFormat (may be one of AudioMediaSubtypes) 55 | /// 56 | public Guid SubFormat { get { return subFormat; } } 57 | 58 | /// 59 | /// Serialize 60 | /// 61 | /// 62 | public override void Serialize(System.IO.BinaryWriter writer) 63 | { 64 | base.Serialize(writer); 65 | writer.Write(wValidBitsPerSample); 66 | writer.Write(dwChannelMask); 67 | byte[] guid = subFormat.ToByteArray(); 68 | writer.Write(guid, 0, guid.Length); 69 | } 70 | 71 | /// 72 | /// String representation 73 | /// 74 | public override string ToString() 75 | { 76 | return String.Format("{0} wBitsPerSample:{1} dwChannelMask:{2} subFormat:{3} extraSize:{4}", 77 | base.ToString(), 78 | wValidBitsPerSample, 79 | dwChannelMask, 80 | subFormat, 81 | extraSize); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormatExtensible.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d0e3542e85464541a0022c04d0da8b6 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormatExtraData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | using System.IO; 6 | 7 | namespace NAudio.Wave.WZT 8 | { 9 | /// 10 | /// This class used for marshalling from unmanaged code 11 | /// 12 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)] 13 | public class WaveFormatExtraData : WaveFormat 14 | { 15 | // try with 100 bytes for now, increase if necessary 16 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)] 17 | private byte[] extraData = new byte[100]; 18 | 19 | /// 20 | /// Allows the extra data to be read 21 | /// 22 | public byte[] ExtraData { get { return extraData; } } 23 | 24 | /// 25 | /// parameterless constructor for marshalling 26 | /// 27 | internal WaveFormatExtraData() 28 | { 29 | } 30 | 31 | /// 32 | /// Reads this structure from a BinaryReader 33 | /// 34 | public WaveFormatExtraData(BinaryReader reader) 35 | : base(reader) 36 | { 37 | ReadExtraData(reader); 38 | } 39 | 40 | internal void ReadExtraData(BinaryReader reader) 41 | { 42 | if (this.extraSize > 0) 43 | { 44 | reader.Read(extraData, 0, extraSize); 45 | } 46 | } 47 | 48 | /// 49 | /// Writes this structure to a BinaryWriter 50 | /// 51 | public override void Serialize(BinaryWriter writer) 52 | { 53 | base.Serialize(writer); 54 | if (extraSize > 0) 55 | { 56 | writer.Write(extraData, 0, extraSize); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveFormatExtraData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fad90a98c9bb79f4e86bf7f8e56d85b9 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveStream.cs: -------------------------------------------------------------------------------- 1 | // created on 27/12/2002 at 20:20 2 | using System; 3 | using System.IO; 4 | using NAudio.Lame; 5 | 6 | namespace NAudio.Wave.WZT 7 | { 8 | /// 9 | /// Base class for all WaveStream classes. Derives from stream. 10 | /// 11 | public abstract class WaveStream : Stream, IWaveProvider 12 | { 13 | /// 14 | /// Retrieves the WaveFormat for this stream 15 | /// 16 | public abstract WaveFormat WaveFormat { get; } 17 | 18 | // base class includes long Position get; set 19 | // base class includes long Length get 20 | // base class includes Read 21 | // base class includes Dispose 22 | 23 | /// 24 | /// We can read from this stream 25 | /// 26 | public override bool CanRead { get { return true; } } 27 | 28 | /// 29 | /// We can seek within this stream 30 | /// 31 | public override bool CanSeek { get { return true; } } 32 | 33 | /// 34 | /// We can't write to this stream 35 | /// 36 | public override bool CanWrite { get { return false; } } 37 | 38 | /// 39 | /// Flush does not need to do anything 40 | /// See 41 | /// 42 | public override void Flush() { } 43 | 44 | /// 45 | /// An alternative way of repositioning. 46 | /// See 47 | /// 48 | public override long Seek(long offset, SeekOrigin origin) 49 | { 50 | if (origin == SeekOrigin.Begin) 51 | Position = offset; 52 | else if (origin == SeekOrigin.Current) 53 | Position += offset; 54 | else 55 | Position = Length + offset; 56 | return Position; 57 | } 58 | 59 | /// 60 | /// Sets the length of the WaveStream. Not Supported. 61 | /// 62 | /// 63 | public override void SetLength(long length) 64 | { 65 | throw new NotSupportedException("Can't set length of a WaveFormatString"); 66 | } 67 | 68 | /// 69 | /// Writes to the WaveStream. Not Supported. 70 | /// 71 | public override void Write(byte[] buffer, int offset, int count) 72 | { 73 | throw new NotSupportedException("Can't write to a WaveFormatString"); 74 | } 75 | 76 | /// 77 | /// The block alignment for this wavestream. Do not modify the Position 78 | /// to anything that is not a whole multiple of this value 79 | /// 80 | public virtual int BlockAlign 81 | { 82 | get 83 | { 84 | return WaveFormat.BlockAlign; 85 | } 86 | } 87 | 88 | /// 89 | /// Moves forward or backwards the specified number of seconds in the stream 90 | /// 91 | /// Number of seconds to move, can be negative 92 | public void Skip(int seconds) 93 | { 94 | lock (this) 95 | { 96 | long newPosition = Position + WaveFormat.AverageBytesPerSecond * seconds; 97 | if (newPosition > Length) 98 | Position = Length; 99 | else if (newPosition < 0) 100 | Position = 0; 101 | else 102 | Position = newPosition; 103 | } 104 | } 105 | 106 | /// 107 | /// The current position in the stream in Time format 108 | /// 109 | public virtual TimeSpan CurrentTime 110 | { 111 | get 112 | { 113 | return TimeSpan.FromSeconds((double)Position / WaveFormat.AverageBytesPerSecond); 114 | } 115 | set 116 | { 117 | Position = (long) (value.TotalSeconds * WaveFormat.AverageBytesPerSecond); 118 | } 119 | } 120 | 121 | /// 122 | /// Total length in real-time of the stream (may be an estimate for compressed files) 123 | /// 124 | public virtual TimeSpan TotalTime 125 | { 126 | get 127 | { 128 | 129 | return TimeSpan.FromSeconds((double) Length / WaveFormat.AverageBytesPerSecond); 130 | } 131 | } 132 | 133 | /// 134 | /// Whether the WaveStream has non-zero sample data at the current position for the 135 | /// specified count 136 | /// 137 | /// Number of bytes to read 138 | public virtual bool HasData(int count) 139 | { 140 | return Position < Length; 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Lame/NAudio/WaveStream.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e3938bcd2820f546a28486ea4b7ba5d 3 | timeCreated: 1493208131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e80a9d89abf09748a9a1a7428a882b8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7721f3b7b022be04a85d4030fa6cfe98 3 | folderAsset: yes 4 | timeCreated: 1493113029 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a7d75e69fd032a46bd4687af202b1f8 3 | folderAsset: yes 4 | timeCreated: 1493124849 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/arm64-v8a.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74d4cac7052b2094b9c8d9b697f02841 3 | folderAsset: yes 4 | timeCreated: 1553864937 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/arm64-v8a/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/Android/libs/arm64-v8a/libmp3lame.so -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/arm64-v8a/libmp3lame.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 673a24e661c22644fbb16983267b8416 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Android: Android 16 | second: 17 | enabled: 1 18 | settings: 19 | CPU: ARM64 20 | - first: 21 | Any: 22 | second: 23 | enabled: 0 24 | settings: {} 25 | - first: 26 | Editor: Editor 27 | second: 28 | enabled: 0 29 | settings: 30 | DefaultValueInitialized: true 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/armeabi-v7a.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 323459e64325449409415ed5b6f9b7ec 3 | folderAsset: yes 4 | timeCreated: 1493114060 5 | licenseType: Pro 6 | PluginImporter: 7 | serializedVersion: 1 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | platformData: 12 | Android: 13 | enabled: 1 14 | settings: {} 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | userData: 23 | assetBundleName: 24 | assetBundleVariant: 25 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/armeabi-v7a/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/Android/libs/armeabi-v7a/libmp3lame.so -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/armeabi-v7a/libmp3lame.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5079b7970e95bc4d93291b0eecd50ff 3 | timeCreated: 1493114099 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Android: 12 | enabled: 1 13 | settings: 14 | CPU: ARMv7 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | userData: 23 | assetBundleName: 24 | assetBundleVariant: 25 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e243f72b6359fca45924fbeed9941749 3 | folderAsset: yes 4 | timeCreated: 1493114054 5 | licenseType: Pro 6 | PluginImporter: 7 | serializedVersion: 1 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | platformData: 12 | Android: 13 | enabled: 1 14 | settings: {} 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | userData: 23 | assetBundleName: 24 | assetBundleVariant: 25 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/x86/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/Android/libs/x86/libmp3lame.so -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/Android/libs/x86/libmp3lame.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae5a1caf80162664ebb525a1b14d3e02 3 | timeCreated: 1493114116 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Android: 12 | enabled: 1 13 | settings: 14 | CPU: x86 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | userData: 23 | assetBundleName: 24 | assetBundleVariant: 25 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06bd442699761b84dbb59714adb87435 3 | folderAsset: yes 4 | timeCreated: 1493113036 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/iOS/libmp3lame.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/iOS/libmp3lame.a -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/iOS/libmp3lame.a.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afb3065c6a5e940239f4645d1da9175a 3 | timeCreated: 1493215407 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | iOS: 19 | enabled: 1 20 | settings: {} 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dc07fa05074ac848ac0fd4a2a68ad56 3 | folderAsset: yes 4 | PluginImporter: 5 | externalObjects: {} 6 | serializedVersion: 2 7 | iconMap: {} 8 | executionOrder: {} 9 | defineConstraints: [] 10 | isPreloaded: 0 11 | isOverridable: 0 12 | isExplicitlyReferenced: 0 13 | validateReferences: 1 14 | platformData: 15 | - first: 16 | Any: 17 | second: 18 | enabled: 0 19 | settings: {} 20 | - first: 21 | Editor: Editor 22 | second: 23 | enabled: 1 24 | settings: 25 | DefaultValueInitialized: true 26 | - first: 27 | Standalone: OSXUniversal 28 | second: 29 | enabled: 1 30 | settings: {} 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36e581751f68744caa08872f006b2680 3 | folderAsset: yes 4 | timeCreated: 1515556075 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Headers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2b82e11cd3904d18bbeb682e3359237 3 | folderAsset: yes 4 | timeCreated: 1515556075 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Headers/lame.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4158ebc6ac7542a7a46ba99ca25fb76 3 | timeCreated: 1515556075 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 17C88 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | lame 11 | CFBundleIdentifier 12 | com.sgkj.lame 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | lame 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 9C40b 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 17C76 35 | DTSDKName 36 | macosx10.13 37 | DTXcode 38 | 0920 39 | DTXcodeBuild 40 | 9C40b 41 | NSHumanReadableCopyright 42 | Copyright © 2018年 sbooth.org. All rights reserved. 43 | 44 | 45 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e02e12a8b8ce44ed88c7f97dbe19f52d 3 | timeCreated: 1515556075 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 148816131111a406faab31c7be9fabe4 3 | folderAsset: yes 4 | timeCreated: 1515556075 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/MacOS/lame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/MacOS/lame -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/MacOS/lame.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6f4b4f07b65e4b17980462114b9692f 3 | timeCreated: 1515556075 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa84d78183b384a53a07b07b4dafbea1 3 | folderAsset: yes 4 | timeCreated: 1515556075 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | NSHumanReadableCopyright 22 | Copyright © 2018年 sbooth.org. All rights reserved. 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/Resources/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 708471da8aa5a423f956944c2beb763d 3 | timeCreated: 1515556075 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/_CodeSignature.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 181b06a7a87514b57a6159da3f3b32a6 3 | folderAsset: yes 4 | timeCreated: 1515556075 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/Info.plist 8 | 9 | j38r/HNoA/kD/xXvliRRgixkbOI= 10 | 11 | 12 | files2 13 | 14 | Headers/lame.h 15 | 16 | hash2 17 | 18 | sw5NP1uyR7rSeBdY2QYE8pzETdW9ef7hMKrvfH0lvPA= 19 | 20 | 21 | Resources/Info.plist 22 | 23 | hash2 24 | 25 | F2Ui6HZEFXbz3Rp7jLzd84Ofeav7U9XNdqTNCKjfsNI= 26 | 27 | 28 | 29 | rules 30 | 31 | ^Resources/ 32 | 33 | ^Resources/.*\.lproj/ 34 | 35 | optional 36 | 37 | weight 38 | 1000 39 | 40 | ^Resources/.*\.lproj/locversion.plist$ 41 | 42 | omit 43 | 44 | weight 45 | 1100 46 | 47 | ^Resources/Base\.lproj/ 48 | 49 | weight 50 | 1010 51 | 52 | ^version.plist$ 53 | 54 | 55 | rules2 56 | 57 | .*\.dSYM($|/) 58 | 59 | weight 60 | 11 61 | 62 | ^(.*/)?\.DS_Store$ 63 | 64 | omit 65 | 66 | weight 67 | 2000 68 | 69 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 70 | 71 | nested 72 | 73 | weight 74 | 10 75 | 76 | ^.* 77 | 78 | ^Info\.plist$ 79 | 80 | omit 81 | 82 | weight 83 | 20 84 | 85 | ^PkgInfo$ 86 | 87 | omit 88 | 89 | weight 90 | 20 91 | 92 | ^Resources/ 93 | 94 | weight 95 | 20 96 | 97 | ^Resources/.*\.lproj/ 98 | 99 | optional 100 | 101 | weight 102 | 1000 103 | 104 | ^Resources/.*\.lproj/locversion.plist$ 105 | 106 | omit 107 | 108 | weight 109 | 1100 110 | 111 | ^Resources/Base\.lproj/ 112 | 113 | weight 114 | 1010 115 | 116 | ^[^/]+$ 117 | 118 | nested 119 | 120 | weight 121 | 10 122 | 123 | ^embedded\.provisionprofile$ 124 | 125 | weight 126 | 20 127 | 128 | ^version\.plist$ 129 | 130 | weight 131 | 20 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/lame.bundle/Contents/_CodeSignature/CodeResources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a86be2cc5c33e4a5d99be6d77972cf57 3 | timeCreated: 1515556075 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a1747509dce2bc4ebd495f009e84ae3 3 | folderAsset: yes 4 | timeCreated: 1493113894 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/x86/libmp3lame.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/x86/libmp3lame.dll -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/x86/libmp3lame.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0552d860d69eb5439d4c01a1140675e 3 | timeCreated: 1493114174 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Android: 12 | enabled: 0 13 | settings: 14 | CPU: AnyCPU 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | CPU: x86 22 | DefaultValueInitialized: true 23 | OS: AnyOS 24 | Linux: 25 | enabled: 1 26 | settings: 27 | CPU: x86 28 | Linux64: 29 | enabled: 0 30 | settings: 31 | CPU: None 32 | LinuxUniversal: 33 | enabled: 1 34 | settings: 35 | CPU: x86 36 | OSXIntel: 37 | enabled: 1 38 | settings: 39 | CPU: AnyCPU 40 | OSXIntel64: 41 | enabled: 0 42 | settings: 43 | CPU: None 44 | OSXUniversal: 45 | enabled: 0 46 | settings: 47 | CPU: x86 48 | Win: 49 | enabled: 1 50 | settings: 51 | CPU: AnyCPU 52 | Win64: 53 | enabled: 0 54 | settings: 55 | CPU: None 56 | iOS: 57 | enabled: 0 58 | settings: 59 | CompileFlags: 60 | FrameworkDependencies: 61 | userData: 62 | assetBundleName: 63 | assetBundleVariant: 64 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41a0c2ada380a744eaba4e8bd5344129 3 | folderAsset: yes 4 | timeCreated: 1493113901 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/x86_64/libmp3lame.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/Assets/SaveToMp3/Plugins/x86_64/libmp3lame.dll -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Plugins/x86_64/libmp3lame.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30533557537581e45903f7a00083735d 3 | timeCreated: 1493114174 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Android: 12 | enabled: 0 13 | settings: 14 | CPU: AnyCPU 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | CPU: x86_64 22 | DefaultValueInitialized: true 23 | OS: AnyOS 24 | Linux: 25 | enabled: 0 26 | settings: 27 | CPU: None 28 | Linux64: 29 | enabled: 1 30 | settings: 31 | CPU: x86_64 32 | LinuxUniversal: 33 | enabled: 1 34 | settings: 35 | CPU: x86_64 36 | OSXIntel: 37 | enabled: 0 38 | settings: 39 | CPU: None 40 | OSXIntel64: 41 | enabled: 1 42 | settings: 43 | CPU: AnyCPU 44 | OSXUniversal: 45 | enabled: 0 46 | settings: 47 | CPU: x86_64 48 | Win: 49 | enabled: 0 50 | settings: 51 | CPU: None 52 | Win64: 53 | enabled: 1 54 | settings: 55 | CPU: AnyCPU 56 | iOS: 57 | enabled: 0 58 | settings: 59 | CompileFlags: 60 | FrameworkDependencies: 61 | userData: 62 | assetBundleName: 63 | assetBundleVariant: 64 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Readme.txt: -------------------------------------------------------------------------------- 1 | # Save audioClip to MP3 2 | With this package you can save an audioclip to mp3 in unity3d. Also plugin can save audioclip to wav and convert wav to mp3. 3 | 4 | It works with *Windows, Android and IOS(tested)*. And probably on *Mac(untested, but should work)*. 5 | 6 | Lame unity port from https://github.com/3wz/Lame-For-Unity 7 | Wav save script from https://gist.github.com/darktable/2317063 8 | 9 | ### Convert audio clip to mp3 bytes array. For example to send it via network: 10 | ```C# 11 | public AudioClip clip; 12 | 13 | void Start(){ 14 | // Convert wav clip to mp3 bytes array 15 | //128 is recommend bitray for mp3 files 16 | byte[] mp3 = WavToMp3.ConvertWavToMp3(clip, 128); 17 | } 18 | ``` 19 | 20 | 21 | ### Save AudioClip at path with defined bitray as mp3 22 | ```C# 23 | public AudioClip clip; 24 | 25 | void Start(){ 26 | // Save AudioClip at assets path with defined bitray as mp3 27 | //128 is recommend bitray for mp3 files 28 | EncodeMP3.SaveMp3(clip, $"{Application.dataPath}/mp3File", 128); 29 | } 30 | ``` 31 | 32 | ### Save AudioClip at path with as wav 33 | ```C# 34 | public AudioClip clip; 35 | 36 | void Start(){ 37 | // Save AudioClip at assets path as wav 38 | SavWav.SaveWav($"{Application.dataPath}/wavFile", clip); 39 | } 40 | ``` 41 | 42 | 43 | -------------------------------------------------------------------------------- /example-project/Assets/SaveToMp3/Readme.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d318ccd73775e9c4b961ddfa67d65c5a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /example-project/Logs/AssetImportWorker0.log: -------------------------------------------------------------------------------- 1 | Using pre-set license 2 | Built from '2020.2/release' branch; Version is '2020.2.2f1 (068178b99f32) revision 426360'; Using compiler version '192528614'; Build Type 'Release' 3 | OS: 'Windows 10 Pro N; OS build 19041.630; Version 2004; 64bit' Language: 'en' Physical Memory: 16257 MB 4 | BatchMode: 1, IsHumanControllingUs: 0, StartBugReporterOnCrash: 0, Is64bit: 1, IsPro: 0 5 | 6 | COMMAND LINE ARGUMENTS: 7 | C:\Program Files\Unity\Hub\Editor\2020.2.2f1\Editor\Unity.exe 8 | -adb2 9 | -batchMode 10 | -noUpm 11 | -name 12 | AssetImportWorker0 13 | -projectPath 14 | C:/repo/Unity3D-save-audioClip-to-MP3/example-project 15 | -logFile 16 | Logs/AssetImportWorker0.log 17 | -srvPort 18 | 52174 19 | Successfully changed project path to: C:/repo/Unity3D-save-audioClip-to-MP3/example-project 20 | C:/repo/Unity3D-save-audioClip-to-MP3/example-project 21 | Using Asset Import Pipeline V2. 22 | Refreshing native plugins compatible for Editor in 25.00 ms, found 0 plugins. 23 | Preloading 0 native plugins for Editor in 0.00 ms. 24 | Initialize engine version: 2020.2.2f1 (068178b99f32) 25 | [Subsystems] Discovering subsystems at path C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/Resources/UnitySubsystems 26 | [Subsystems] Discovering subsystems at path C:/repo/Unity3D-save-audioClip-to-MP3/example-project/Assets 27 | GfxDevice: creating device client; threaded=0 28 | Direct3D: 29 | Version: Direct3D 11.0 [level 11.1] 30 | Renderer: NVIDIA GeForce GTX 1050 (ID=0x1c8d) 31 | Vendor: 32 | VRAM: 4019 MB 33 | Driver: 27.21.14.5671 34 | Initialize mono 35 | Mono path[0] = 'C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/Managed' 36 | Mono path[1] = 'C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/MonoBleedingEdge/lib/mono/unityjit' 37 | Mono config path = 'C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/MonoBleedingEdge/etc' 38 | Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56980 39 | Begin MonoManager ReloadAssembly 40 | Registering precompiled unity dll's ... 41 | Register platform support module: C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll 42 | Register platform support module: C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/PlaybackEngines/MacStandaloneSupport/UnityEditor.OSXStandalone.Extensions.dll 43 | Register platform support module: C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll 44 | Register platform support module: C:/Program Files/Unity/Hub/Editor/2020.2.2f1/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/UnityEditor.LinuxStandalone.Extensions.dll 45 | Registered in 0.002997 seconds. 46 | Native extension for LinuxStandalone target not found 47 | Native extension for WindowsStandalone target not found 48 | Native extension for OSXStandalone target not found 49 | Native extension for WebGL target not found 50 | Refreshing native plugins compatible for Editor in 35.01 ms, found 0 plugins. 51 | Preloading 0 native plugins for Editor in 0.00 ms. 52 | Invoked RoslynAnalysisRunner static constructor. 53 | RoslynAnalysisRunner will not be running. 54 | RoslynAnalysisRunner has terminated. 55 | Mono: successfully reloaded assembly 56 | - Completed reload, in 2.329 seconds 57 | Platform modules already initialized, skipping 58 | Registering precompiled user dll's ... 59 | Registered in 0.001437 seconds. 60 | Begin MonoManager ReloadAssembly 61 | Native extension for LinuxStandalone target not found 62 | Native extension for WindowsStandalone target not found 63 | Native extension for OSXStandalone target not found 64 | Native extension for WebGL target not found 65 | Refreshing native plugins compatible for Editor in 0.24 ms, found 0 plugins. 66 | Preloading 0 native plugins for Editor in 0.00 ms. 67 | Invoked RoslynAnalysisRunner static constructor. 68 | RoslynAnalysisRunner will not be running. 69 | RoslynAnalysisRunner has terminated. 70 | Mono: successfully reloaded assembly 71 | - Completed reload, in 0.834 seconds 72 | Platform modules already initialized, skipping 73 | ======================================================================== 74 | Worker process is ready to serve import requests 75 | Launched and connected shader compiler UnityShaderCompiler.exe after 0.05 seconds 76 | Refreshing native plugins compatible for Editor in 0.25 ms, found 0 plugins. 77 | Preloading 0 native plugins for Editor in 0.00 ms. 78 | Unloading 1102 Unused Serialized files (Serialized files now loaded: 0) 79 | System memory in use before: 56.7 MB. 80 | System memory in use after: 56.8 MB. 81 | 82 | Unloading 17 unused Assets to reduce memory usage. Loaded Objects now: 1540. 83 | Total: 1.641400 ms (FindLiveObjects: 0.122000 ms CreateObjectMapping: 0.036900 ms MarkObjects: 1.416800 ms DeleteObjects: 0.064500 ms) 84 | 85 | ======================================================================== 86 | Received Import Request. 87 | path: Assets/SaveToMp3/Readme.txt 88 | artifactKey: Guid(d318ccd73775e9c4b961ddfa67d65c5a) Importer(815301076,1909f56bfc062723c751e8b465ee728b) 89 | Start importing Assets/SaveToMp3/Readme.txt using Guid(d318ccd73775e9c4b961ddfa67d65c5a) Importer(815301076,1909f56bfc062723c751e8b465ee728b) -> (artifact id: '65e747f04fb9db2dbfde01cb34bf3771') in 0.049896 seconds 90 | Import took 0.051918 seconds . 91 | 92 | ======================================================================== 93 | Received Prepare 94 | Registering precompiled user dll's ... 95 | Registered in 0.001303 seconds. 96 | Begin MonoManager ReloadAssembly 97 | Native extension for LinuxStandalone target not found 98 | Native extension for WindowsStandalone target not found 99 | Native extension for OSXStandalone target not found 100 | Native extension for WebGL target not found 101 | Refreshing native plugins compatible for Editor in 0.26 ms, found 0 plugins. 102 | Preloading 0 native plugins for Editor in 0.00 ms. 103 | Invoked RoslynAnalysisRunner static constructor. 104 | RoslynAnalysisRunner will not be running. 105 | RoslynAnalysisRunner has terminated. 106 | Mono: successfully reloaded assembly 107 | - Completed reload, in 0.875 seconds 108 | Platform modules already initialized, skipping 109 | Refreshing native plugins compatible for Editor in 0.25 ms, found 0 plugins. 110 | Preloading 0 native plugins for Editor in 0.00 ms. 111 | Unloading 1096 Unused Serialized files (Serialized files now loaded: 0) 112 | System memory in use before: 56.5 MB. 113 | System memory in use after: 56.6 MB. 114 | 115 | Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 1542. 116 | Total: 1.979400 ms (FindLiveObjects: 0.134700 ms CreateObjectMapping: 0.033300 ms MarkObjects: 1.782700 ms DeleteObjects: 0.027200 ms) 117 | 118 | ======================================================================== 119 | Received Import Request. 120 | Time since last request: 73.586131 seconds. 121 | path: Assets/SaveToMp3/Example/ExampleScript.cs 122 | artifactKey: Guid(7a625143d82bde344b2d405499c6bbc8) Importer(815301076,1909f56bfc062723c751e8b465ee728b) 123 | Start importing Assets/SaveToMp3/Example/ExampleScript.cs using Guid(7a625143d82bde344b2d405499c6bbc8) Importer(815301076,1909f56bfc062723c751e8b465ee728b) -> (artifact id: '68c917ce0aa3e9f517e8ba53bd31c405') in 0.015285 seconds 124 | Import took 0.017120 seconds . 125 | 126 | ======================================================================== 127 | Received Prepare 128 | Registering precompiled user dll's ... 129 | Registered in 0.001362 seconds. 130 | Begin MonoManager ReloadAssembly 131 | Native extension for LinuxStandalone target not found 132 | Native extension for WindowsStandalone target not found 133 | Native extension for OSXStandalone target not found 134 | Native extension for WebGL target not found 135 | Refreshing native plugins compatible for Editor in 0.24 ms, found 0 plugins. 136 | Preloading 0 native plugins for Editor in 0.00 ms. 137 | Invoked RoslynAnalysisRunner static constructor. 138 | RoslynAnalysisRunner will not be running. 139 | RoslynAnalysisRunner has terminated. 140 | Mono: successfully reloaded assembly 141 | - Completed reload, in 0.835 seconds 142 | Platform modules already initialized, skipping 143 | Refreshing native plugins compatible for Editor in 0.25 ms, found 0 plugins. 144 | Preloading 0 native plugins for Editor in 0.00 ms. 145 | Unloading 1096 Unused Serialized files (Serialized files now loaded: 0) 146 | System memory in use before: 56.6 MB. 147 | System memory in use after: 56.7 MB. 148 | 149 | Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 1544. 150 | Total: 1.791200 ms (FindLiveObjects: 0.128500 ms CreateObjectMapping: 0.032200 ms MarkObjects: 1.615100 ms DeleteObjects: 0.014100 ms) 151 | 152 | ======================================================================== 153 | Received Import Request. 154 | Time since last request: 111.414463 seconds. 155 | path: Assets/SaveToMp3/Example/ExampleScript.cs 156 | artifactKey: Guid(7a625143d82bde344b2d405499c6bbc8) Importer(815301076,1909f56bfc062723c751e8b465ee728b) 157 | Start importing Assets/SaveToMp3/Example/ExampleScript.cs using Guid(7a625143d82bde344b2d405499c6bbc8) Importer(815301076,1909f56bfc062723c751e8b465ee728b) -> (artifact id: '9fca7d6ff897bd6d81fde5a242a6a85c') in 0.005241 seconds 158 | Import took 0.007518 seconds . 159 | 160 | ======================================================================== 161 | Received Prepare 162 | Registering precompiled user dll's ... 163 | Registered in 0.001754 seconds. 164 | Begin MonoManager ReloadAssembly 165 | Native extension for LinuxStandalone target not found 166 | Native extension for WindowsStandalone target not found 167 | Native extension for OSXStandalone target not found 168 | Native extension for WebGL target not found 169 | Refreshing native plugins compatible for Editor in 0.24 ms, found 0 plugins. 170 | Preloading 0 native plugins for Editor in 0.00 ms. 171 | Invoked RoslynAnalysisRunner static constructor. 172 | RoslynAnalysisRunner will not be running. 173 | RoslynAnalysisRunner has terminated. 174 | Mono: successfully reloaded assembly 175 | - Completed reload, in 0.811 seconds 176 | Platform modules already initialized, skipping 177 | Refreshing native plugins compatible for Editor in 0.25 ms, found 0 plugins. 178 | Preloading 0 native plugins for Editor in 0.00 ms. 179 | Unloading 1096 Unused Serialized files (Serialized files now loaded: 0) 180 | System memory in use before: 56.6 MB. 181 | System memory in use after: 56.7 MB. 182 | 183 | Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 1546. 184 | Total: 1.893500 ms (FindLiveObjects: 0.406400 ms CreateObjectMapping: 0.162100 ms MarkObjects: 1.301300 ms DeleteObjects: 0.021800 ms) 185 | 186 | ======================================================================== 187 | Received Import Request. 188 | Time since last request: 371.412855 seconds. 189 | path: Assets/SaveToMp3/Encoder/WavToMp3.cs 190 | artifactKey: Guid(2bc1aa53ea1d574459f3dbb4eedc5345) Importer(815301076,1909f56bfc062723c751e8b465ee728b) 191 | Start importing Assets/SaveToMp3/Encoder/WavToMp3.cs using Guid(2bc1aa53ea1d574459f3dbb4eedc5345) Importer(815301076,1909f56bfc062723c751e8b465ee728b) -> (artifact id: '2c4544384931f00a63f3daea3ea69beb') in 0.011420 seconds 192 | Import took 0.013315 seconds . 193 | 194 | ======================================================================== 195 | Received Prepare 196 | Registering precompiled user dll's ... 197 | Registered in 0.001376 seconds. 198 | Begin MonoManager ReloadAssembly 199 | Native extension for LinuxStandalone target not found 200 | Native extension for WindowsStandalone target not found 201 | Native extension for OSXStandalone target not found 202 | Native extension for WebGL target not found 203 | Refreshing native plugins compatible for Editor in 0.25 ms, found 0 plugins. 204 | Preloading 0 native plugins for Editor in 0.00 ms. 205 | Invoked RoslynAnalysisRunner static constructor. 206 | RoslynAnalysisRunner will not be running. 207 | RoslynAnalysisRunner has terminated. 208 | Mono: successfully reloaded assembly 209 | - Completed reload, in 0.792 seconds 210 | Platform modules already initialized, skipping 211 | Refreshing native plugins compatible for Editor in 0.29 ms, found 0 plugins. 212 | Preloading 0 native plugins for Editor in 0.00 ms. 213 | Unloading 1096 Unused Serialized files (Serialized files now loaded: 0) 214 | System memory in use before: 56.7 MB. 215 | System memory in use after: 56.8 MB. 216 | 217 | Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 1548. 218 | Total: 2.062100 ms (FindLiveObjects: 0.320000 ms CreateObjectMapping: 0.046000 ms MarkObjects: 1.673800 ms DeleteObjects: 0.021000 ms) 219 | 220 | ======================================================================== 221 | Received Import Request. 222 | Time since last request: 295.430021 seconds. 223 | path: Assets/SaveToMp3/Encoder/EncodeMP3.cs 224 | artifactKey: Guid(5067b4ed11cff42459e750438059a60b) Importer(815301076,1909f56bfc062723c751e8b465ee728b) 225 | Start importing Assets/SaveToMp3/Encoder/EncodeMP3.cs using Guid(5067b4ed11cff42459e750438059a60b) Importer(815301076,1909f56bfc062723c751e8b465ee728b) -> (artifact id: '41eeba7a51c2ceb04a7aa20ed0c940d0') in 0.007527 seconds 226 | Import took 0.009363 seconds . 227 | 228 | ======================================================================== 229 | Received Import Request. 230 | Time since last request: 9.130049 seconds. 231 | path: Assets/SaveToMp3/Encoder/SavWav.cs 232 | artifactKey: Guid(3a4a731eaf00d0149bf9f6900aa4ad39) Importer(815301076,1909f56bfc062723c751e8b465ee728b) 233 | Start importing Assets/SaveToMp3/Encoder/SavWav.cs using Guid(3a4a731eaf00d0149bf9f6900aa4ad39) Importer(815301076,1909f56bfc062723c751e8b465ee728b) -> (artifact id: '448b2912219ec418f0c47592f7872a94') in 0.006241 seconds 234 | Import took 0.008379 seconds . 235 | 236 | AssetImportWorkerClient::OnTransportError - code=2 error=End of file 237 | -------------------------------------------------------------------------------- /example-project/Logs/Packages-Update.log: -------------------------------------------------------------------------------- 1 | 2 | === Thu May 14 21:08:18 2020 3 | 4 | Packages were changed. 5 | Update Mode: resetToDefaultDependencies 6 | 7 | The following packages were added: 8 | com.unity.collab-proxy@1.2.16 9 | com.unity.ide.rider@1.1.4 10 | com.unity.ide.vscode@1.1.4 11 | com.unity.modules.ai@1.0.0 12 | com.unity.modules.androidjni@1.0.0 13 | com.unity.modules.animation@1.0.0 14 | com.unity.modules.assetbundle@1.0.0 15 | com.unity.modules.audio@1.0.0 16 | com.unity.modules.cloth@1.0.0 17 | com.unity.modules.director@1.0.0 18 | com.unity.modules.imageconversion@1.0.0 19 | com.unity.modules.imgui@1.0.0 20 | com.unity.modules.jsonserialize@1.0.0 21 | com.unity.modules.particlesystem@1.0.0 22 | com.unity.modules.physics@1.0.0 23 | com.unity.modules.physics2d@1.0.0 24 | com.unity.modules.screencapture@1.0.0 25 | com.unity.modules.terrain@1.0.0 26 | com.unity.modules.terrainphysics@1.0.0 27 | com.unity.modules.tilemap@1.0.0 28 | com.unity.modules.ui@1.0.0 29 | com.unity.modules.uielements@1.0.0 30 | com.unity.modules.umbra@1.0.0 31 | com.unity.modules.unityanalytics@1.0.0 32 | com.unity.modules.unitywebrequest@1.0.0 33 | com.unity.modules.unitywebrequestassetbundle@1.0.0 34 | com.unity.modules.unitywebrequestaudio@1.0.0 35 | com.unity.modules.unitywebrequesttexture@1.0.0 36 | com.unity.modules.unitywebrequestwww@1.0.0 37 | com.unity.modules.vehicles@1.0.0 38 | com.unity.modules.video@1.0.0 39 | com.unity.modules.vr@1.0.0 40 | com.unity.modules.wind@1.0.0 41 | com.unity.modules.xr@1.0.0 42 | com.unity.test-framework@1.1.13 43 | com.unity.textmeshpro@2.0.1 44 | com.unity.timeline@1.2.14 45 | com.unity.ugui@1.0.0 46 | 47 | === Mon Feb 8 20:08:49 2021 48 | 49 | Packages were changed. 50 | Update Mode: updateDependencies 51 | 52 | The following packages were added: 53 | com.unity.ide.visualstudio@2.0.5 54 | The following packages were updated: 55 | com.unity.collab-proxy from version 1.2.16 to 1.3.9 56 | com.unity.ide.rider from version 1.1.4 to 2.0.7 57 | com.unity.ide.vscode from version 1.1.4 to 1.2.3 58 | com.unity.test-framework from version 1.1.13 to 1.1.20 59 | com.unity.textmeshpro from version 2.0.1 to 3.0.1 60 | -------------------------------------------------------------------------------- /example-project/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.3.9", 4 | "com.unity.ide.rider": "2.0.7", 5 | "com.unity.ide.visualstudio": "2.0.5", 6 | "com.unity.ide.vscode": "1.2.3", 7 | "com.unity.test-framework": "1.1.20", 8 | "com.unity.textmeshpro": "3.0.1", 9 | "com.unity.timeline": "1.2.14", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /example-project/Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": { 4 | "version": "1.3.9", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": {}, 8 | "url": "https://packages.unity.com" 9 | }, 10 | "com.unity.ext.nunit": { 11 | "version": "1.0.6", 12 | "depth": 1, 13 | "source": "registry", 14 | "dependencies": {}, 15 | "url": "https://packages.unity.com" 16 | }, 17 | "com.unity.ide.rider": { 18 | "version": "2.0.7", 19 | "depth": 0, 20 | "source": "registry", 21 | "dependencies": { 22 | "com.unity.test-framework": "1.1.1" 23 | }, 24 | "url": "https://packages.unity.com" 25 | }, 26 | "com.unity.ide.visualstudio": { 27 | "version": "2.0.5", 28 | "depth": 0, 29 | "source": "registry", 30 | "dependencies": {}, 31 | "url": "https://packages.unity.com" 32 | }, 33 | "com.unity.ide.vscode": { 34 | "version": "1.2.3", 35 | "depth": 0, 36 | "source": "registry", 37 | "dependencies": {}, 38 | "url": "https://packages.unity.com" 39 | }, 40 | "com.unity.test-framework": { 41 | "version": "1.1.20", 42 | "depth": 0, 43 | "source": "registry", 44 | "dependencies": { 45 | "com.unity.ext.nunit": "1.0.6", 46 | "com.unity.modules.imgui": "1.0.0", 47 | "com.unity.modules.jsonserialize": "1.0.0" 48 | }, 49 | "url": "https://packages.unity.com" 50 | }, 51 | "com.unity.textmeshpro": { 52 | "version": "3.0.1", 53 | "depth": 0, 54 | "source": "registry", 55 | "dependencies": { 56 | "com.unity.ugui": "1.0.0" 57 | }, 58 | "url": "https://packages.unity.com" 59 | }, 60 | "com.unity.timeline": { 61 | "version": "1.2.14", 62 | "depth": 0, 63 | "source": "registry", 64 | "dependencies": {}, 65 | "url": "https://packages.unity.com" 66 | }, 67 | "com.unity.ugui": { 68 | "version": "1.0.0", 69 | "depth": 0, 70 | "source": "builtin", 71 | "dependencies": { 72 | "com.unity.modules.ui": "1.0.0", 73 | "com.unity.modules.imgui": "1.0.0" 74 | } 75 | }, 76 | "com.unity.modules.ai": { 77 | "version": "1.0.0", 78 | "depth": 0, 79 | "source": "builtin", 80 | "dependencies": {} 81 | }, 82 | "com.unity.modules.androidjni": { 83 | "version": "1.0.0", 84 | "depth": 0, 85 | "source": "builtin", 86 | "dependencies": {} 87 | }, 88 | "com.unity.modules.animation": { 89 | "version": "1.0.0", 90 | "depth": 0, 91 | "source": "builtin", 92 | "dependencies": {} 93 | }, 94 | "com.unity.modules.assetbundle": { 95 | "version": "1.0.0", 96 | "depth": 0, 97 | "source": "builtin", 98 | "dependencies": {} 99 | }, 100 | "com.unity.modules.audio": { 101 | "version": "1.0.0", 102 | "depth": 0, 103 | "source": "builtin", 104 | "dependencies": {} 105 | }, 106 | "com.unity.modules.cloth": { 107 | "version": "1.0.0", 108 | "depth": 0, 109 | "source": "builtin", 110 | "dependencies": { 111 | "com.unity.modules.physics": "1.0.0" 112 | } 113 | }, 114 | "com.unity.modules.director": { 115 | "version": "1.0.0", 116 | "depth": 0, 117 | "source": "builtin", 118 | "dependencies": { 119 | "com.unity.modules.audio": "1.0.0", 120 | "com.unity.modules.animation": "1.0.0" 121 | } 122 | }, 123 | "com.unity.modules.imageconversion": { 124 | "version": "1.0.0", 125 | "depth": 0, 126 | "source": "builtin", 127 | "dependencies": {} 128 | }, 129 | "com.unity.modules.imgui": { 130 | "version": "1.0.0", 131 | "depth": 0, 132 | "source": "builtin", 133 | "dependencies": {} 134 | }, 135 | "com.unity.modules.jsonserialize": { 136 | "version": "1.0.0", 137 | "depth": 0, 138 | "source": "builtin", 139 | "dependencies": {} 140 | }, 141 | "com.unity.modules.particlesystem": { 142 | "version": "1.0.0", 143 | "depth": 0, 144 | "source": "builtin", 145 | "dependencies": {} 146 | }, 147 | "com.unity.modules.physics": { 148 | "version": "1.0.0", 149 | "depth": 0, 150 | "source": "builtin", 151 | "dependencies": {} 152 | }, 153 | "com.unity.modules.physics2d": { 154 | "version": "1.0.0", 155 | "depth": 0, 156 | "source": "builtin", 157 | "dependencies": {} 158 | }, 159 | "com.unity.modules.screencapture": { 160 | "version": "1.0.0", 161 | "depth": 0, 162 | "source": "builtin", 163 | "dependencies": { 164 | "com.unity.modules.imageconversion": "1.0.0" 165 | } 166 | }, 167 | "com.unity.modules.subsystems": { 168 | "version": "1.0.0", 169 | "depth": 1, 170 | "source": "builtin", 171 | "dependencies": { 172 | "com.unity.modules.jsonserialize": "1.0.0" 173 | } 174 | }, 175 | "com.unity.modules.terrain": { 176 | "version": "1.0.0", 177 | "depth": 0, 178 | "source": "builtin", 179 | "dependencies": {} 180 | }, 181 | "com.unity.modules.terrainphysics": { 182 | "version": "1.0.0", 183 | "depth": 0, 184 | "source": "builtin", 185 | "dependencies": { 186 | "com.unity.modules.physics": "1.0.0", 187 | "com.unity.modules.terrain": "1.0.0" 188 | } 189 | }, 190 | "com.unity.modules.tilemap": { 191 | "version": "1.0.0", 192 | "depth": 0, 193 | "source": "builtin", 194 | "dependencies": { 195 | "com.unity.modules.physics2d": "1.0.0" 196 | } 197 | }, 198 | "com.unity.modules.ui": { 199 | "version": "1.0.0", 200 | "depth": 0, 201 | "source": "builtin", 202 | "dependencies": {} 203 | }, 204 | "com.unity.modules.uielements": { 205 | "version": "1.0.0", 206 | "depth": 0, 207 | "source": "builtin", 208 | "dependencies": { 209 | "com.unity.modules.ui": "1.0.0", 210 | "com.unity.modules.imgui": "1.0.0", 211 | "com.unity.modules.jsonserialize": "1.0.0", 212 | "com.unity.modules.uielementsnative": "1.0.0" 213 | } 214 | }, 215 | "com.unity.modules.uielementsnative": { 216 | "version": "1.0.0", 217 | "depth": 1, 218 | "source": "builtin", 219 | "dependencies": { 220 | "com.unity.modules.ui": "1.0.0", 221 | "com.unity.modules.imgui": "1.0.0", 222 | "com.unity.modules.jsonserialize": "1.0.0" 223 | } 224 | }, 225 | "com.unity.modules.umbra": { 226 | "version": "1.0.0", 227 | "depth": 0, 228 | "source": "builtin", 229 | "dependencies": {} 230 | }, 231 | "com.unity.modules.unityanalytics": { 232 | "version": "1.0.0", 233 | "depth": 0, 234 | "source": "builtin", 235 | "dependencies": { 236 | "com.unity.modules.unitywebrequest": "1.0.0", 237 | "com.unity.modules.jsonserialize": "1.0.0" 238 | } 239 | }, 240 | "com.unity.modules.unitywebrequest": { 241 | "version": "1.0.0", 242 | "depth": 0, 243 | "source": "builtin", 244 | "dependencies": {} 245 | }, 246 | "com.unity.modules.unitywebrequestassetbundle": { 247 | "version": "1.0.0", 248 | "depth": 0, 249 | "source": "builtin", 250 | "dependencies": { 251 | "com.unity.modules.assetbundle": "1.0.0", 252 | "com.unity.modules.unitywebrequest": "1.0.0" 253 | } 254 | }, 255 | "com.unity.modules.unitywebrequestaudio": { 256 | "version": "1.0.0", 257 | "depth": 0, 258 | "source": "builtin", 259 | "dependencies": { 260 | "com.unity.modules.unitywebrequest": "1.0.0", 261 | "com.unity.modules.audio": "1.0.0" 262 | } 263 | }, 264 | "com.unity.modules.unitywebrequesttexture": { 265 | "version": "1.0.0", 266 | "depth": 0, 267 | "source": "builtin", 268 | "dependencies": { 269 | "com.unity.modules.unitywebrequest": "1.0.0", 270 | "com.unity.modules.imageconversion": "1.0.0" 271 | } 272 | }, 273 | "com.unity.modules.unitywebrequestwww": { 274 | "version": "1.0.0", 275 | "depth": 0, 276 | "source": "builtin", 277 | "dependencies": { 278 | "com.unity.modules.unitywebrequest": "1.0.0", 279 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 280 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 281 | "com.unity.modules.audio": "1.0.0", 282 | "com.unity.modules.assetbundle": "1.0.0", 283 | "com.unity.modules.imageconversion": "1.0.0" 284 | } 285 | }, 286 | "com.unity.modules.vehicles": { 287 | "version": "1.0.0", 288 | "depth": 0, 289 | "source": "builtin", 290 | "dependencies": { 291 | "com.unity.modules.physics": "1.0.0" 292 | } 293 | }, 294 | "com.unity.modules.video": { 295 | "version": "1.0.0", 296 | "depth": 0, 297 | "source": "builtin", 298 | "dependencies": { 299 | "com.unity.modules.audio": "1.0.0", 300 | "com.unity.modules.ui": "1.0.0", 301 | "com.unity.modules.unitywebrequest": "1.0.0" 302 | } 303 | }, 304 | "com.unity.modules.vr": { 305 | "version": "1.0.0", 306 | "depth": 0, 307 | "source": "builtin", 308 | "dependencies": { 309 | "com.unity.modules.jsonserialize": "1.0.0", 310 | "com.unity.modules.physics": "1.0.0", 311 | "com.unity.modules.xr": "1.0.0" 312 | } 313 | }, 314 | "com.unity.modules.wind": { 315 | "version": "1.0.0", 316 | "depth": 0, 317 | "source": "builtin", 318 | "dependencies": {} 319 | }, 320 | "com.unity.modules.xr": { 321 | "version": "1.0.0", 322 | "depth": 0, 323 | "source": "builtin", 324 | "dependencies": { 325 | "com.unity.modules.physics": "1.0.0", 326 | "com.unity.modules.jsonserialize": "1.0.0", 327 | "com.unity.modules.subsystems": "1.0.0" 328 | } 329 | } 330 | } 331 | } 332 | -------------------------------------------------------------------------------- /example-project/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /example-project/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/PresetManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.2.2f1 2 | m_EditorVersionWithRevision: 2020.2.2f1 (068178b99f32) 3 | -------------------------------------------------------------------------------- /example-project/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/VFXManager.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Team-on/Unity3D-save-audioClip-to-MP3/0f7bfa8387a5292b4628a6a7c718d10c89bbda0c/example-project/ProjectSettings/VersionControlSettings.asset -------------------------------------------------------------------------------- /example-project/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /example-project/UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedScenePath-0: 9 | value: 22424703114646680c1809161f0e4f435932002b21382a35620d183eedd3373dece278fce9332b25 10 | flags: 0 11 | vcSharedLogLevel: 12 | value: 0d5e400f0650 13 | flags: 0 14 | m_VCAutomaticAdd: 1 15 | m_VCDebugCom: 0 16 | m_VCDebugCmd: 0 17 | m_VCDebugOut: 0 18 | m_SemanticMergeMode: 2 19 | m_VCShowFailedCheckout: 1 20 | m_VCOverwriteFailedCheckoutAssets: 1 21 | m_VCProjectOverlayIcons: 1 22 | m_VCHierarchyOverlayIcons: 1 23 | m_VCOtherOverlayIcons: 1 24 | m_VCAllowAsyncUpdate: 1 25 | --------------------------------------------------------------------------------