如何生成随机数以保存波形文件 [英] How to generate random numbers to save wave files

查看:195
本文介绍了如何生成随机数以保存波形文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我正在处理Text To Speech。我希望我的所有TTS输出都以不同的名称保存?如何在ASP.NET中执行此操作..?

Hi
I am working on Text To Speech . I want all my TTS outputs to get saved in different names? How can I do this in ASP.NET..?

推荐答案

有很多不同的方法可以做到这一点。

As Wes有人提出,Random类是一种方式 - 但是这不保证唯一值,因为随机数就是这样。



根据生成它们的频率,一种更好的方法可能是使用日期/时间戳,包括微秒计数(但如果文件之间的间隔小于14ms左右,这可能会失败)



另一个好处方法是使用Guid值:两个相同值的可能性很小,以至于无关紧要!
There are a lot of different ways to do this.
As Wes has suggested, the Random class is one way - but that doesn't guarantee unique values as random numbers are just that.

Depending on how often you are generating them, one better way might be to use the date/time stamp including the microseconds count (but this could fail if your interval between files is less than around 14ms)

Another good approach is to use a Guid value: the chances of two identical values is so small as to be insignificant!


这篇关于如何生成随机数以保存波形文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆